[Tutor] IOError when importing nose

Albert-Jan Roskam fomcl at yahoo.com
Sat Jul 13 16:14:16 CEST 2013


Hi,

I am using nose on my laptop (installed it using sudo pip install nose), but I get the following error, unless I run python as sudo. Why is this happening, and what can I do to solve this problem? Maybe use chown? I uninstalled and reinstalled the package already, but it did not solve the problem.


Python 2.7.3 (default, Sep 26 2012, 21:53:58) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nose
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/nose/__init__.py", line 1, in <module>
    from nose.core import collector, main, run, run_exit, runmodule
  File "/usr/local/lib/python2.7/dist-packages/nose/core.py", line 11, in <module>
    from nose.config import Config, all_config_files
  File "/usr/local/lib/python2.7/dist-packages/nose/config.py", line 9, in <module>
    from nose.plugins.manager import NoPlugins
  File "/usr/local/lib/python2.7/dist-packages/nose/plugins/__init__.py", line 185, in <module>
    from nose.plugins.manager import *
  File "/usr/local/lib/python2.7/dist-packages/nose/plugins/manager.py", line 418, in <module>
    import pkg_resources
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 2823, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 710, in subscribe
    callback(dist)
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 2823, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 2255, in activate
    self.insert_on(path)
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 2362, in insert_on
    self.check_version_conflict()
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 2401, in check_version_conflict
    for modname in self._get_metadata('top_level.txt'):
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 2249, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 1219, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 1211, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 1326, in _get
    stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pypi_classifiers-0.1-py2.7.egg/EGG-INFO/top_level.txt'
>>> quit()
antonia at antonia-HP-2133 /usr/local/lib/python2.7/dist-packages/pypi_classifiers-0.1-py2.7.egg/EGG-INFO $ ls -l
total 24
-rw------- 1 root staff    1 Jan 26 14:36 dependency_links.txt
-rw------- 1 root staff 1311 Jan 26 14:36 PKG-INFO
drwxr-sr-x 2 root staff 4096 Jan 26 14:36 scripts
-rw------- 1 root staff  269 Jan 26 14:36 SOURCES.txt
-rw------- 1 root staff   16 Jan 26 14:36 top_level.txt
-rw-r--r-- 1 root staff    1 Jan 26 14:36 zip-safe

 0.1-py2.7.egg/EGG-INFO $ 
antonia at antonia-HP-2133 /usr/local/lib/python2.7/dist-packages/pypi_classifiers-0.1-py2.7.egg/EGG-INFO $ cd scripts
antonia at antonia-HP-2133 /usr/local/lib/python2.7/dist-packages/pypi_classifiers-0.1-py2.7.egg/EGG-INFO/scripts $ ls -l
total 4
-rwxr-xr-x 1 root staff 1386 Jan 26 14:36 pypi-classifiers

Thank you in advance!


Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a 
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 


More information about the Tutor mailing list