Importing scipy.misc.pilutil in python using Komodo and Anaconda?

1.7k views Asked by At

Anaconda installs with Scipy, and in the scipy-0.12.0-np17py27_0.json file, this is listed:

"Lib/site-packages/scipy/misc/pilutil.py", 
"Lib/site-packages/scipy/misc/pilutil.pyc",

In the library folder, this is listed:

Lib/site-packages/scipy/misc/pilutil.py

But, running this:

import scipy.misc.pilutil as smp

Gives me this error:

AttributeError: 'module' object has no attribute 'pilutil'
1

There are 1 answers

0
Viktor Kerkez On

The problem is that the scipy.misc.__init__ deletes the pilutil module - relevant code line - so you cannot import it directly. But all functions from the pilutil module are, before that, added to the misc module, and you can use them from there:

In [1]: from scipy import misc
In [2]: misc.fromimage
Out[2]: <function scipy.misc.pilutil.fromimage>
In [3]: misc.bytescale
Out[3]: <function scipy.misc.pilutil.bytescale>