py2exe problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bwaha

    #1

    py2exe problem

    First time trying to create an executable with py2exe. I have a small
    program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'),
    matplotlib ('0.83.2'), win32com (latest?), Numeric ('23.7') on Windows XP &
    Win2000. The program runs without problem but as an exe it doesn't even get
    to showing the GUI.

    I get the following error log when I run the executable.

    Traceback (most recent call last):
    File "mpival3.py ", line 1264, in ?
    File "wx\_core.p yc", line 7668, in __init__
    File "wx\_core.p yc", line 7320, in _BootstrapApp
    File "mpival3.py ", line 364, in OnInit
    File "mpival3.py ", line 79, in __init__
    File "mpival3.py ", line 204, in restore_inputs
    File "mpival3.py ", line 275, in setConfig
    File "wx\_controls.p yc", line 621, in SetValue
    TypeError: String or Unicode type required

    Line 621 in wx\_controls.py c refers to setting the value of a combobox at
    the start up of my code. The initial values of various widgets (checkboxes,
    textboxes and comboboxes) are stored in a pickled file which is read at the
    program start. Running the program, not the exe, shows that the variables
    are retrieved properly and of the correct type for the combobox.SetVal ue
    method.

    Furthermore, if I comment out the code to set the combobox value and
    recreate the exe, then I get the same sort of error message for a different
    (textbox) widget.

    I've read all the py2exe WIKI entries, forum posts and Googled myself
    senseless ... now I'm stuck. Can anyone shed any light on this problem, or
    have some experience to share?

    As an aside, I've found this a very frustrating process at this stage. Never
    thought it would be so much trouble. Am I just dreaming in thinking I can
    package up my program with this combination of modules?.


    fwiw my py2exe setup.py file is included below. It's obviously a concoction
    of includes, excludes and other options pieced together from hours of
    browsing wiki's etc.

    Thanks.

    Chris

    =============== =============== ====

    # setup.py
    from distutils.core import setup
    import py2exe
    import sys

    # If run without args, build executables, in quiet mode.
    if len(sys.argv) == 1:
    sys.argv.append ("py2exe")
    sys.argv.append ("-q")


    # Matplotlib
    # We need to import the glob module to search for all files.
    import glob
    # We need to exclude matplotlib backends not being used by this executable.
    You may find
    # that you need different excludes to create a working executable with your
    chosen backend.
    # We also need to include matplotlib.nume rix.random_arra y
    options = {"py2exe": {
    "includes": ["matplotlib.num erix.random_arr ay",
    "matplotlib.bac kends.backend_t kagg", "encodings" ,
    "encodings. *"],
    # "includes": ["matplotlib ", "Numeric", "scipy",
    "scipy_base "],
    # "excludes": ["_gtkagg", "_tkagg"],
    "packages": ["pytz"],
    "dll_exclud es": ['libgdk-win32-2.0-0.dll',
    'libgobject-2.0-0.dll']
    }
    }

    # Additional data files are required by matplotlib. Note that the glob.glob
    routine
    # doesn't seem to pick up the .matplotlib resource file, so I copy that
    separately.
    # Do the same if you need to
    #datf = [(r'matplotlibda ta', glob.glob(r'c:\ python23\share\ matplotlib\*')) ,
    # (r'matplotlibda ta',
    [r'c:\python23\s hare\matplotlib \.matplotlibrc'])]
    datf = [(r'matplotlibda ta', glob.glob(r'c:\ python23\share\ matplotlib\*'))]


    # for scipy
    excludes = []
    includes = ["scipy.special. __cvs_version__ ", "scipy.linalg._ _cvs_version__" ,
    "scipy.special. cephes"]
    options["py2exe"]["includes"].extend(include s)

    # other
    #options["py2exe"]["compressed "] = 1
    #options["py2exe"]["optimize"] = 2
    #options["py2exe"]["ascii"] = 1
    #options["py2exe"]["bundle_fil es"] = 3
    #options["py2exe"]["skip_archi ve"] = 1

    setup(
    options = options,
    data_files = datf,
    name = 'validation',
    description = 'Validation Program',
    windows = ['mpival3.py']
    )




  • Serge Orlov

    #2
    Re: py2exe problem

    bwaha wrote:[color=blue]
    > First time trying to create an executable with py2exe. I have a small
    > program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'),
    > matplotlib ('0.83.2'), win32com (latest?), Numeric ('23.7') on Windows XP &
    > Win2000. The program runs without problem but as an exe it doesn't even get
    > to showing the GUI.[/color]

    Do you have more than one wxwindows installed? Check you site-packages.
    Do you follow documentation
    http://wiki.wxpython.org/index.cgi/MultiVersionInstalls ? Seems like
    py2exe picks wrong wxwindows. Insert printing of wx.VERSION and
    wx.PlatformInfo and try to run it packaged and non-packaged.

    Serge

    Comment

    • bwaha

      #3
      Re: py2exe problem


      "Serge Orlov" <Serge.Orlov@gm ail.com> wrote in message
      news:1145134511 .975204.232650@ g10g2000cwb.goo glegroups.com.. .[color=blue]
      > bwaha wrote:[color=green]
      > > First time trying to create an executable with py2exe. I have a small
      > > program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'),
      > > matplotlib ('0.83.2'), win32com (latest?), Numeric ('23.7') on Windows[/color][/color]
      XP &[color=blue][color=green]
      > > Win2000. The program runs without problem but as an exe it doesn't even[/color][/color]
      get[color=blue][color=green]
      > > to showing the GUI.[/color]
      >
      > Do you have more than one wxwindows installed? Check you site-packages.
      > Do you follow documentation
      > http://wiki.wxpython.org/index.cgi/MultiVersionInstalls ? Seems like
      > py2exe picks wrong wxwindows. Insert printing of wx.VERSION and
      > wx.PlatformInfo and try to run it packaged and non-packaged.
      >
      > Serge
      >[/color]

      Thanks for the suggestion, but I definitely have only one version installed.
      In fact I uninstalled it and installed an earlier version (2.5.5.1) to see
      if it was specifically wxPython related. No change.



      Comment

      • Serge Orlov

        #4
        Re: py2exe problem

        bwaha wrote:[color=blue]
        > Thanks for the suggestion, but I definitely have only one version installed.
        > In fact I uninstalled it and installed an earlier version (2.5.5.1) to see
        > if it was specifically wxPython related. No change.[/color]

        Then why don't you try to print what is passed to SetValue in the exe,
        just change windows = ['mpival3.py'] in setup.py with console =
        ['mpival3.py'] and add prints.

        Comment

        • bwaha

          #5
          Re: py2exe problem


          "Serge Orlov" <Serge.Orlov@gm ail.com> wrote in message
          news:1145183181 .942584.311190@ g10g2000cwb.goo glegroups.com.. .[color=blue]
          > bwaha wrote:[color=green]
          > > Thanks for the suggestion, but I definitely have only one version[/color][/color]
          installed.[color=blue][color=green]
          > > In fact I uninstalled it and installed an earlier version (2.5.5.1) to[/color][/color]
          see[color=blue][color=green]
          > > if it was specifically wxPython related. No change.[/color]
          >
          > Then why don't you try to print what is passed to SetValue in the exe,
          > just change windows = ['mpival3.py'] in setup.py with console =
          > ['mpival3.py'] and add prints.
          >[/color]

          Thanks. Turned out to be user error. I was trying to SetValue(None).


          Comment

          Working...