I am trying to use wxPython (the version that ships with Fedora 11 - I'm not building it from source). I am seeing:

from wxPython.wx import *
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/__init__.py", line 15, in <module>
    import _wx
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/_wx.py", line 3, in <module>
    from _core import *
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/_core.py", line 15, in <module>
    import wx._core
ImportError: No module named _core

I tried adding:

export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython:/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx:/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode

to my path in .bashrc, but it didn't change anything.

Any suggestions?

Thanks,

Dave

Recommended Answers

All 11 Replies

Is this correct?
from wxPython.wx import *
In any case, you may have to install/re-install wxPython.

_core.py indeed exists there. I just installed wxPython this morning (sudo yum install wxPython*) so I don't think reinstalling would change anything. Any other thoughts?

Thanks,

Dave

This is what I have

>>> from wxPython.wx import *
__main__:1: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained.  Please switch to the wx package as soon as possible.
>>> import wx
>>>

I see that deprecation warning, but then it doesn't work.

[doriad@davedesktop gecko]$ python
Python 2.6 (r26:66714, Jul  4 2009, 17:37:22) 
[GCC 4.4.0 20090506 (Red Hat 4.4.0-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from wxPython.wx import *
__main__:1: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained.  Please switch to the wx package as soon as possible.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/__init__.py", line 15, in <module>
    import _wx
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/_wx.py", line 3, in <module>
    from _core import *
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/_core.py", line 15, in <module>
    import wx._core
ImportError: No module named _core

However, import wx seems to work fine. Should I just use that instead?

Dave

Yes, I think you should use import wx.

You can not have wxGTK and wxPython installed at the same time. This bit me a while back. Check to see if wxGTK is installed. Also, check that /usr/bin/python is a symlink to /usr/bin/python2.6 and the same for /usr/lib/python.

If I

sudo yum remove wxGTK

it tries to remove wxPython as well. Is there a way to remove it without removing wxPython?

Thanks,
Dave

A bit of background - I am trying to get an existing script to run. I tried to replace this line:

>>> from wxPython.glcanvas import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/__init__.py", line 15, in <module>
    import _wx
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/_wx.py", line 3, in <module>
    from _core import *
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/_core.py", line 15, in <module>
    import wx._core
ImportError: No module named _core

with this:

>>> from wx.glcanvas import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named glcanvas

and it looks like wx doesn't have a glcanvas.

Is wx not going to be very backwards compatible with wxPython?

Dave

Keying just this into a terminal on my Slackware machine works fine
from wx.glcanvas import *
so it has to be something with the install. Take a look at this link http://www.wxpython.org/download.php I have MESA installed so that may be the difference. You should also try searching the Fedora forum as someone else has probably had this problem.

Hello All,

Can any one help to fix this issue

python

" raj@elogin03:~/software/wxPython-4.0.1/final/lib64/python2.7/site-packages> python
Python 2.7.9 (default, Dec 21 2014, 11:02:59) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "wx/core.py", line 12, in <module>
    from ._core import *
ImportError: No module named _core

Install the current 3.x version of python. That version of wxPython won't run under 2.x python.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.