Problem with wxPython

Arrowsama
2005-04-20
2013-04-16
  • Arrowsama

    Arrowsama - 2005-04-20

    I'm have just started using kubuntu and the first thing I wanted working was abc so I put all my efforts into it. As you can see, I'm a newbie in Linux.
    When I write "python abc.py" i get the message:

    Traceback (most recent call last):
      File "abc.py", line 3, in ?
        from wxPython.wx import *
    ImportError: No module named wxPython.wx

    I don't know what does it mean and I'd like some sort of help. Last thing to say is that I have python and wxPython installed in their last version and that I've added the very first line "import sys".

    ><)))'>

     
    • Damnation85

      Damnation85 - 2005-07-10

      this one is very simple it means u don't have the package and u need to get it, i use mandrake so i can't tell u how to get it. but for me its

      urpmi wxPythonGTK

      hope that helps

       
    • Bobbias

      Bobbias - 2006-01-02

      How would I get this for Yoper, I don't know the package name, and apt-get seems to be broken (never worked once)
      and I can't find any RPMs for this (I've installed 2 different RPMs for wxPython)

       
    • Matthew Ng

      Matthew Ng - 2006-01-02

      This problem also occurs if you have more than one wxpython installed on your os.

      Which will raise this error:
      Traceback (most recent call last):
        File "abc.py", line 10, in ?
          import wx
      ImportError: No module named wx

      Here is the code I used to select the proper wx version.

      Replace line 10: import wx with:
      #<Begin of code>
      # For system with more than one version of WxPython installed.
      try:
          import wxversion
          for version in wxversion.getInstalled():
              # Select the first version of WxPython with unicode.
              if "unicode" in version:
                  wxversion.select(version)
                  sys.stdout.write("WxPython version: %s" %(version))
                  break
          if "unicode" not in version:
              # If no WxPython with unicode exists,
              # select the first version available.
              wxversion(wxversion.getInstalled()[0])
      except ImportError, err:
          pass

      try:
          import wx   
      except ImportError, err:
          sys.stderr.write("%s\n" %(str(err)))
          sys.stderr.write("Cannot import WxPython, please ensure WxPython is installed.\n")
          sys.stderr.write("WxPython is available at http://www.wxpython.org/\n"\)
          sys.exit(2)
      #<End of code>

      ABC Python version: ABC-win32-v3.0.1b

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks