Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temporary directories are not removed #189

Closed
axelvonkamp opened this issue May 11, 2021 · 3 comments · Fixed by #197 or #224
Closed

temporary directories are not removed #189

axelvonkamp opened this issue May 11, 2021 · 3 comments · Fixed by #197 or #224
Labels

Comments

@axelvonkamp
Copy link

axelvonkamp commented May 11, 2021

The temporary directory which Oct2Py() creates when no temp_dir parameter is given is not removed when the object is deleted. Automatic cleanup could be achieved by replacing
self.temp_dir = temp_dir or tempfile.mkdtemp()
with

        if temp_dir is None:
            self.temp_dir_obj = tempfile.TemporaryDirectory()
            self.temp_dir = self.temp_dir_obj.name
        else:
            self.temp_dir = temp_dir

in core.py.

@blink1073
Copy link
Owner

Thanks! Fixed in #197

@josepalos
Copy link

Currently, using Python 3.8.5, a ResourceWarning is raised when the temporary directories are automatically deleted.
Could you please reopen this issue?

The exact warning is:

ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpaxnmyi6v'>
  _warnings.warn(warn_message, ResourceWarning)

This can be reproduced in Python 3.8.5 with a script only containing the line from oct2py import Oct2Py

@blink1073
Copy link
Owner

Thanks for the heads up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants