0

I've installed the python module pyvirtualdisplay from https://pypi.python.org/pypi/PyVirtualDisplay

It says it should work on python version 3.3

I then execute the code in python 3.3:

from pyvirtualdisplay import Display
myDisplay = Display(visible=0, size=(800, 600))

This produces the following error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./display.py", line 37, in __init__
**kwargs)
File "/home/thesaleb/python33/lib/python3.3/site-   packages/pyvirtualdisplay/xvfb.py", line 33, in __init__
AbstractDisplay.__init__(self)
File "/home/thesaleb/python33/lib/python3.3/site-packages/pyvirtualdisplay/abstractdisplay.py", line 25, in __init__
self.display = self.search_for_display()
File "/home/thesaleb/python33/lib/python3.3/site-packages/pyvirtualdisplay/abstractdisplay.py", line 50, in search_for_display
if len(ls):
TypeError: object of type 'map' has no len()

From what I've looked up it seems other people have had this TypeError when trying to execute python 2 code in python 3 environments. Indeed, I installed everything on a python 2 environment and all the code works fine.

So, am I missing something, should this code work in python 3.3 or did they lie when they said it was compatible? Also this was all done on a linux machine and I'm a linux newbie so I could've messed up some python installation or something. Anybody have any ideas?

Thanks

bluemoon12
  • 73
  • 1
  • 8
  • In 2.x, `map` returns a list with a length. In 3.x, `map` returns an iterator, which does not have a length. I have no idea why 3.2 and 3.3 are listed as supported. Go to the homepage and try to contact the author. You might also look into the code and see whether the failing statement is always executed or if there is a prior condition that would normally bypass it. – Terry Jan Reedy Dec 05 '15 at 16:38
  • Hm ya it seems strange because this module seems semi-popular for what it does (though I guess it could be kind of niche). It just seems surprising they would get the Python 3 compability wrong.. – bluemoon12 Dec 07 '15 at 11:30

0 Answers0