Hi Juan, On Sat, Mar 21, 2015 at 11:00:58AM -0700, Juan Riquelme wrote: > Hi :). > > I wrote a simple widget for cmus <https://cmus.github.io/> , for my > personal usage (of course, if applicable, I want to share it). And it seems > to work, but when, according to Hacking on Qtile > <http://docs.qtile.org/en/latest/manual/hacking.html>, I try to pass the > appropriate test > > nosetests --tests=test_widget > > from a *virtualenv* environment, but I get nothing but errors. I installed > a bunch of packages with *pip*, but still I get certain errors caused by > other widgets. Specifically the *wlan* widget: > > 18:46 $ nosetests --tests=test_widget > E > ====================================================================== > ERROR: Failure: SystemError (Parent module '' not loaded, cannot perform > relative import) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/nose/failure.py" > , line 39, in runTest > raise self.exc_val.with_traceback(self.tb) > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/nose/loader.py" > , line 414, in loadTestsFromName > addr.filename, addr.module) > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/nose/importer.py" > , line 47, in importFromPath > return self.importFromDir(dir_path, fqname) > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/nose/importer.py" > , line 94, in importFromDir > mod = load_module(part_fqname, fh, filename, desc) > File "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/imp.py", > line 235, in load_module > return load_source(name, filename, file) > File "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/imp.py", > line 171, in load_source > module = methods.load() > File "<frozen importlib._bootstrap>", line 1220, in load > File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked > File "<frozen importlib._bootstrap>", line 1129, in _exec > File "<frozen importlib._bootstrap>", line 1471, in exec_module > File "<frozen importlib._bootstrap>", line 321, in > _call_with_frames_removed > File "/home/soulchainer/.github/qtile/test/test_widget.py", line 27, in > <module> > from .utils import Xephyr > nose.proxy.SystemError: Parent module '' not loaded, cannot perform > relative import > -------------------- >> begin captured logging << -------------------- > qtile: WARNING: Can't Import Widget: '.wlan.Wlan', No module named ' > pythonwifi' > qtile: DEBUG: Traceback (most recent call last): > File "/home/soulchainer/.github/qtile/libqtile/widget/__init__.py", line > 46, in safe_import > module = importlib.import_module(module_name, package) > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/importlib/__init__.py", > > line 109, in import_module > return _bootstrap._gcd_import(name[level:], package, level) > File "<frozen importlib._bootstrap>", line 2254, in _gcd_import > File "<frozen importlib._bootstrap>", line 2237, in _find_and_load > File "<frozen importlib._bootstrap>", line 2226, in > _find_and_load_unlocked > File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked > File "<frozen importlib._bootstrap>", line 1129, in _exec > File "<frozen importlib._bootstrap>", line 1471, in exec_module > File "<frozen importlib._bootstrap>", line 321, in > _call_with_frames_removed > File "/home/soulchainer/.github/qtile/libqtile/widget/wlan.py", line 28, > in <module> > from pythonwifi.iwlibs import Wireless, Iwstats > ImportError: No module named 'pythonwifi' > > --------------------- >> end captured logging << --------------------- > > ---------------------------------------------------------------------- > Ran 1 test in 0.001s > > FAILED (errors=1) > > I get that the *pythonwifi* module is needed, but, when can I find it? > If I search it with *pip*, don't get anything. It appears that the module > is given by *python-wifi*, but if I install that package with pip, I get > another error about that package: > > 18:47 $ nosetests --tests=test_widget > E > ====================================================================== > ERROR: Failure: SyntaxError (invalid syntax (iwlibs.py, line 78)) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/nose/failure.py" > , line 39, in runTest > raise self.exc_val.with_traceback(self.tb) > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/nose/loader.py" > , line 414, in loadTestsFromName > addr.filename, addr.module) > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/nose/importer.py" > , line 47, in importFromPath > return self.importFromDir(dir_path, fqname) > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/nose/importer.py" > , line 94, in importFromDir > mod = load_module(part_fqname, fh, filename, desc) > File "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/imp.py", > line 235, in load_module > return load_source(name, filename, file) > File "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/imp.py", > line 171, in load_source > module = methods.load() > File "<frozen importlib._bootstrap>", line 1220, in load > File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked > File "<frozen importlib._bootstrap>", line 1129, in _exec > File "<frozen importlib._bootstrap>", line 1471, in exec_module > File "<frozen importlib._bootstrap>", line 321, in > _call_with_frames_removed > File "/home/soulchainer/.github/qtile/test/test_widget.py", line 23, in > <module> > from libqtile.config import Screen > File "/home/soulchainer/.github/qtile/libqtile/config.py", line 35, in > <module> > from .widget.base import deprecated > File "/home/soulchainer/.github/qtile/libqtile/widget/__init__.py", line > 90, in <module> > safe_import(".wlan", "Wlan") > File "/home/soulchainer/.github/qtile/libqtile/widget/__init__.py", line > 46, in safe_import > module = importlib.import_module(module_name, package) > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/importlib/__init__.py" > , line 109, in import_module > return _bootstrap._gcd_import(name[level:], package, level) > File "/home/soulchainer/.github/qtile/libqtile/widget/wlan.py", line 28, > in <module> > from pythonwifi.iwlibs import Wireless, Iwstats > File > "/home/soulchainer/.virtualenvs/qtile_dev/lib/python3.4/site-packages/pythonwifi/iwlibs.py" > , line 78 > except IOError, (i, error): > ^ > SyntaxError: invalid syntax > > ---------------------------------------------------------------------- > Ran 1 test in 0.001s > > FAILED (errors=1) > > > So, I'm not sure about it. What can I do about this? Anyone knows about a > package for pip that works for this? Am I doing something bad? Is this not > needed or what? Nobody is asking, so, it works? Ô_ó. > I use Python 3.4.3 in the virtualenv.
I think python-wifi might be python2 only, so that's where your problem is. I think the original problem (i.e. the SyntaxError about relative imports) might be avoided by not using the --tests argument. Instead, I think you can do something like (from the qtile root): nosetests3 -v -d tests.test_widget And it should work. Tycho > Thanks ;). > > -- > You received this message because you are subscribed to the Google Groups > "qtile-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "qtile-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
