Unable to create the Python console [solved]

Application: pcbnew
Version: 5.1.2+dfsg1-1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.64.0 OpenSSL/1.1.1c zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.37.0 librtmp/2.3
Platform: Linux 4.19.0-5-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.67.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.64.0
Compiler: Clang 7.0.1 with C++ ABI 1002

Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=ON
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON

====

Traceback (most recent call last):
File “”, line 1, in
File “/usr/share/kicad/scripting/kicad_pyshell/init.py”, line 17, in
import wx
File “/usr/local/lib/python3.7/dist-packages/wx/init.py”, line 12, in
version = wx.version.VERSION_STRING
AttributeError: module ‘wx’ has no attribute ‘version

====

what’s wrong?
how can i fix this?

wx.version is a function! So your call is wrong.

$ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> print(wx.version())
4.0.4 gtk3 (phoenix) wxWidgets 3.0.4
>>> 

BTW: You really should give more context!

thank you for reply.

the error msg output is from pcbnew, when I click “scripting console”

 ~ » pcbnew                                                                                   marco@thinkPad
09:40:08 AM: Debug: Disabling glCopyBuffer() on intel GPU

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/share/kicad/scripting/kicad_pyshell/__init__.py", line 17, in <module>
    import wx
  File "/usr/local/lib/python3.7/dist-packages/wx/__init__.py", line 12, in <module>
    __version__ = wx.__version__.VERSION_STRING
AttributeError: module 'wx' has no attribute '__version__'

====

when i import wx in python console, it’s ok

 ~ » ipython                                                                                  marco@thinkPad
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.6.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import wx                                                                                           

In [2]: wx.version()                                                                                        
Out[2]: '4.0.6 gtk3 (phoenix) wxWidgets 3.0.5'

just remove wxPython from pip3, and apt install python3-wxgtk4

it fixed…

Thank you!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.