py2exe wx.__version__.pyc issue

Hopefully this is a simple issue.

I have created a simple setup.py script for compiling a py2exe of my
wx based application. This works ok and I get my desired "dist" and
"build" folders.

When launching the exe file I get the following error :

Traceback (most recent call last):
  File "Launcher.py", line 6, in <module>
    from Wx.Control import Controller
  File "wx\__init__.pyc", line 14, in <module>
ImportError: No module named __version__

if I locate the wx\__version__.pyc and copy into the root of the
library.zip file, then this problem is avoided.
Also, with simpler wx based python scripts then this issue does not
occur. What type of python scripting could cause this type of issue. I
have included below the inital part of module "Control" if this helps.

""""""
execfile(r'c:\pyRfic.txt')
import wx
import wx.grid
from MfgComs import MfgData, MfgCom, MfgTools
from GuiData import GuiDataExport,GuiDataImport
from RfData import FieldExport, RegExport
from Wx.Gui import Top,Bot,Mfg,Rfic,Ctrl
from RfTools import Common
from RfTools import Freq
from RfTools import Mode
from Tools import Conversion

Sws = {}

class Controller(wx.Frame):
    def __init__(self,Gui,Control):
....
....
....
"""""""

1) Does anyone have any idea why it is not finding this in the wx\
folder?
2) If I have to, does anyone know how I can add this module into the
compilation automatically ( i.e. from my setup script )? It is not
clear to me how you do this ( controlling the source and destination
of the module file )

If useful, I can provide the py2exe output

Many Thanks wxPython-users!

Hi Lee,

Hopefully this is a simple issue.

I have created a simple setup.py script for compiling a py2exe of my
wx based application. This works ok and I get my desired "dist" and
"build" folders.

When launching the exe file I get the following error :

Traceback (most recent call last):
File "Launcher.py", line 6, in <module>
from Wx.Control import Controller
File "wx\__init__.pyc", line 14, in <module>
ImportError: No module named __version__

if I locate the wx\__version__.pyc and copy into the root of the
library.zip file, then this problem is avoided.
Also, with simpler wx based python scripts then this issue does not
occur. What type of python scripting could cause this type of issue. I
have included below the inital part of module "Control" if this helps.

""""""
execfile(r'c:\pyRfic.txt')
import wx
import wx.grid
from MfgComs import MfgData, MfgCom, MfgTools
from GuiData import GuiDataExport,GuiDataImport
from RfData import FieldExport, RegExport
from Wx.Gui import Top,Bot,Mfg,Rfic,Ctrl
from RfTools import Common
from RfTools import Freq
from RfTools import Mode
from Tools import Conversion

Sws = {}

class Controller(wx.Frame):
def __init__(self,Gui,Control):
....
....
....
"""""""

1) Does anyone have any idea why it is not finding this in the wx\
folder?
2) If I have to, does anyone know how I can add this module into the
compilation automatically ( i.e. from my setup script )? It is not
clear to me how you do this ( controlling the source and destination
of the module file )

If useful, I can provide the py2exe output

Many Thanks wxPython-users!

I use Andrea's handy GUI2Exe program, which makes adding and excluding
modules quite trivial. I don't know why py2exe would exclude the
version file automatically though. Anyway, here's the link:

http://code.google.com/p/gui2exe/

And if you'd like a lesson on it's usage, then you might find my
tutorial helpful:

HTH

···

On Jan 7, 5:45 am, Lee Walczak <lee.walc...@gmail.com> wrote:

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

PyCon 2010 Atlanta Feb 19-21 http://us.pycon.org/

Lee Walczak wrote:

Hopefully this is a simple issue.

I have created a simple setup.py script for compiling a py2exe of my
wx based application. This works ok and I get my desired "dist" and
"build" folders.

When launching the exe file I get the following error :

Traceback (most recent call last):
  File "Launcher.py", line 6, in <module>
    from Wx.Control import Controller
  File "wx\__init__.pyc", line 14, in <module>
ImportError: No module named __version__

if I locate the wx\__version__.pyc and copy into the root of the
library.zip file, then this problem is avoided.
Also, with simpler wx based python scripts then this issue does not
occur. What type of python scripting could cause this type of issue. I
have included below the inital part of module "Control" if this helps.

""""""
execfile(r'c:\pyRfic.txt')
import wx
import wx.grid
from MfgComs import MfgData, MfgCom, MfgTools
from GuiData import GuiDataExport,GuiDataImport
from RfData import FieldExport, RegExport
from Wx.Gui import Top,Bot,Mfg,Rfic,Ctrl
from RfTools import Common
from RfTools import Freq
from RfTools import Mode
from Tools import Conversion

Sws = {}

class Controller(wx.Frame):
    def __init__(self,Gui,Control):
....
"""""""

1) Does anyone have any idea why it is not finding this in the wx\
folder?
2) If I have to, does anyone know how I can add this module into the
compilation automatically ( i.e. from my setup script )? It is not
clear to me how you do this ( controlling the source and destination
of the module file )

If useful, I can provide the py2exe output

Many Thanks wxPython-users!
  

What is "Wx.Gui"? I assume that is your stuff.

Is the name space maybe getting muddled up as Windows is often not case sensitive?

Maybe call your stuff "mywx.gui" and then add "mywx" package to the packages instruction of py2exe.

Werner

Wx.Gui are Windows Folders where python scripts are contained.

i.e. …\PythonWorkSpace\Wx\Gui

i have python scripts in both Wx and Gui. Started with Wx but did not consider it to be a potential hazard, but I guess you are right. I should use something else.

···

Many Thanks wxPython-users!

What is “Wx.Gui”? I assume that is your stuff.

Is the name space maybe getting muddled up as Windows is often not case sensitive?

Maybe call your stuff “mywx.gui” and then add “mywx” package to the packages instruction of py2exe.

Werner