Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
"from plumbum.cmd import" does not work on python 3.3 #56
When trying to import any command in python 3.3 following exception occurs
>>> from plumbum.cmd import wc Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<frozen importlib._bootstrap>", line 1597, in _handle_fromlist File "/usr/lib/python3.3/site-packages/plumbum/local_machine.py", line 537, in __getitem__ return LocalCommand(self.which(cmd)) File "/usr/lib/python3.3/site-packages/plumbum/local_machine.py", line 508, in which raise CommandNotFound(progname, list(cls.env.path)) plumbum.commands.CommandNotFound: ('__path__', [<LocalPath /usr/local/bin>, <LocalPath /usr/bin>, <LocalPath /bin>, <LocalPath /usr/local/sbin>, <LocalPath /usr/sbin>, <LocalPath /sbin>, <LocalPath ~/bin>, <LocalPath /usr/bin/vendor_perl>, <LocalPath /usr/bin/core_perl>, <LocalPath /usr/lib/qt4/bin>, <LocalPath /home/blin/bin>, <LocalPath /home/blin/bin>])
This seems to be due to http://docs.python.org/3/whatsnew/3.3.html#importlib
What happens is that
Proposed solution is to replace
__getattr__ = local.__getitem__
in cmd with
def __getattr__(self, name): if name != '__path__': return local.__getitem__(name) else: pass
does it not solve the issue?