lambdamusic / Ontospy

Python library and command-line interface for inspecting and visualizing RDF models aka ontologies.
http://lambdamusic.github.io/Ontospy/
MIT License
219 stars 52 forks source link

Delete only contents, but not the output folder itself #62

Open KMax opened 6 years ago

KMax commented 6 years ago

It'd be easier to integrate ontodocs with Docker if it'd not try to delete the output directory attached as a volume. Ontodocs should delete only the contents of the output folder, but not the folder itself.

ontodocs_1  | Traceback (most recent call last):
ontodocs_1  |   File "/usr/bin/ontodocs", line 11, in <module>
ontodocs_1  |     sys.exit(main_cli())
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
ontodocs_1  |     return self.main(*args, **kwargs)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
ontodocs_1  |     rv = self.invoke(ctx)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
ontodocs_1  |     return ctx.invoke(self.callback, **ctx.params)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
ontodocs_1  |     return callback(*args, **kwargs)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/main.py", line 94, in main_cli
ontodocs_1  |     url = action_visualize(source, fromshell=False, path=outputpath, title=title, theme=theme, verbose=verbose)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/core/builder.py", line 184, in action_visualize
ontodocs_1  |     url  = build_visualization(ontouri, g, viztype, path, title, theme)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/core/builder.py", line 226, in build_visualization
ontodocs_1  |     url = v.build(path)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/core/viz_factory.py", line 92, in build
ontodocs_1  |     self.output_path = self.checkOutputPath(output_path)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/core/viz_factory.py", line 221, in checkOutputPath
ontodocs_1  |     shutil.rmtree(output_path)
ontodocs_1  |   File "/usr/lib64/python2.7/shutil.py", line 256, in rmtree
ontodocs_1  |     onerror(os.rmdir, path, sys.exc_info())
ontodocs_1  |   File "/usr/lib64/python2.7/shutil.py", line 254, in rmtree
ontodocs_1  |     os.rmdir(path)
ontodocs_1  | OSError: [Errno 16] Device or resource busy: './docs'