Subject: Bug#534: Windows: PyHoca-GUI fails to start (ImportError: No module named wx)

From: Michael DePaulo <[email-masked]>
Date: Sat, 5 Jul 2014 09:46:24 -0400

package: pyhoca-gui
version: 0.5.0.0-preview

For some reason I cannot figure out, on my home desktop (Windows 8.1
with update 1 64-bit) I experience the error below when I try to
launch PyHoca-GUI in development mode.

I have not been able to testPyHoca-GUI in regular/installed mode due to #531.

Yet on the X2Go-WinBuilder VM (Windows 7 64-bit SP1,) which I am
almost certain I did the same exact setup work on (according to the
instructions immediately below), it does not have the problem. It
launches pyhoca-gui successfully.
http://wiki.x2go.org/doku.php/wiki:development:build-howto-mswin:pyhoca-gui

I've attached a 1 line fix. I'd like to discuss it before I commit it.

--------
>From Msysgit 1.9.4-preview20140611 bash:

mike@EXECUTOR:/c/x2gobuilds/pyhoca-gui :) [95] $ which python
/c/Python27/python
 mike@EXECUTOR:/c/x2gobuilds/pyhoca-gui :) [96] $ python --version
Python 2.7.8
 mike@EXECUTOR:/c/x2gobuilds/pyhoca-gui :( [97] $ ./pyhoca-gui
--start-xserver --lang=en
Traceback (most recent call last):
  File "./pyhoca-gui", line 33, in <module>
    from pyhoca.wxgui.launcher import PyHocaGUI_Launcher
  File "c:\x2gobuilds\pyhoca-gui\pyhoca\wxgui\launcher.py", line 45, in <module>
    import wx
ImportError: No module named wx
Exception KeyError: KeyError(32843536,) in <module 'threading' from
'c:\Python27\lib\threading.pyc'> ignored
 mike@EXECUTOR:/c/x2gobuilds/pyhoca-gui :( [98] $

--------
>From cmd.exe:

C:\x2gobuilds\pyhoca-gui>which python
C:\Python27\python.EXE

C:\x2gobuilds\pyhoca-gui>python --version
Python 2.7.8

C:\x2gobuilds\pyhoca-gui>python ./pyhoca-gui --start-xserver --lang=en
Traceback (most recent call last):
  File "./pyhoca-gui", line 33, in <module>
    from pyhoca.wxgui.launcher import PyHocaGUI_Launcher
  File "C:\x2gobuilds\pyhoca-gui\pyhoca\wxgui\launcher.py", line 45, in <module>
    import wx
ImportError: No module named wx
Exception KeyError: KeyError(31671760,) in <module 'threading' from
'C:\Python27\lib\threading.pyc'> ignored

C:\x2gobuilds\pyhoca-gui>

---

From: Mike Gabriel <[email-masked]>
Date: Sat, 05 Jul 2014 22:21:01 +0000

Hi Michael,

> I've attached a 1 line fix. I'd like to discuss it before I commit it.

IMHO you have to make sure that the correct wx version is loaded.

So if we place an "import wx" into pyhoca-gui(.exe), we should make  
sure the correct wx.version is used. So "import wx" needs to be blown  
up to:

"""
try:
     import wxversion
     wxversion.select('2.9')
except: pass

try:
     import wxversion
     wxversion.select('2.8')
except: pass

import wx
"""

If that fixes the problem on Windows, I am happy with these extra  
lines in pyhoca-gui. (Please accompany those lines with a comment that  
explains, why the import occurs there, although the wx module is not  
used in pyhoca-gui(.exe) directly (but only in submodules).

Mike
-- 

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
fon: +49 (1520) 1976 148

GnuPG Key ID 0x25771B31
mail: [email-masked], http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb

---

From: Michael DePaulo <[email-masked]>
Date: Sun, 6 Jul 2014 10:44:35 -0400

> import wx

Actually, on both machines, I installed wxPython 3.0.

Is 3.0 OK? Or should I downgrade them to 2.9?

-Mike#2