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

Memory.clear() exception when cachedir=None #200

Closed
bmcfee opened this issue Mar 30, 2015 · 1 comment
Closed

Memory.clear() exception when cachedir=None #200

bmcfee opened this issue Mar 30, 2015 · 1 comment
Labels

Comments

@bmcfee
Copy link

bmcfee commented Mar 30, 2015

[note: I hit this on 0.8.4, but I suspect it affects earlier versions as well.]

Creating a dummy Memory object (using cachedir=None) isn't as transparent as it could be. Trying to clear the cache causes a TypeError:

In [1]: import joblib

In [2]: M = joblib.Memory(cachedir=None)

In [3]: M.clear()
WARNING:root:[Memory(cachedir=None)]: Flushing completely the cache
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-f5283b9ae328> in <module>()
----> 1 M.clear()

/usr/local/lib/python2.7/dist-packages/joblib/memory.pyc in clear(self, warn)
    880         if warn:
    881             self.warn('Flushing completely the cache')
--> 882         rm_subdirs(self.cachedir)
    883 
    884     def eval(self, func, *args, **kwargs):

/usr/local/lib/python2.7/dist-packages/joblib/disk.pyc in rm_subdirs(path, onerror)
     81     names = []
     82     try:
---> 83         names = os.listdir(path)
     84     except os.error as err:
     85         if onerror is not None:

TypeError: coercing to Unicode: need string or buffer, NoneType found

I would expect clear() on a dummy Memory object to be a silent no-op, so this seems like a bug.

@lesteve lesteve added the bug label Mar 30, 2015
@lesteve
Copy link
Member

lesteve commented Mar 30, 2015

Confirmed, seems like a bug indeed.

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

No branches or pull requests

2 participants