Missing classes in wxPython - python

In the documentation of wxPython there are some classes that are missing.
For example: TextCompleter.
But in python I get:
>>> import wx
>>> print wx.__version__
2.9.3.1
>>> from wx import TextCompleter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name TextCompleter
I have also tried with the newest version of wxPython (3.0)

As you may have noted, you are referring to the wxPython (Phoenix) documentation. You however have the classic version installed, where TextCompleter has not been wrapped in SWIG (and probably never will, because development effort is concentrated on Phoenix). This class has been wrapped in Phoenix. If you are absolutely interested in trying out Phoenix, set up a virtualenv and pip install <path-to-wheel> a snapshot build. Do yourself a favor and download the wheel matching your python to local disk before trying to install the .whl-file.

Related

import yaml missing error module

>>> import yaml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tools/python_libs/yaml/__init__.py", line 2, in <module>
from error import *
ModuleNotFoundError: No module named 'error'
I don't see how to set my PYTHONPATH with anaconda3.
Am I missing an install step?
I have the same situation, but with the ROS. The same error reproduces when you use python 3 instead of python 2. You can see corresponding discussion
here. For some reasons I would like to use python3 instead of python2, so I need to find out, how to get rid of this error.
I can suggest two solutions right now:
Either use python2 instead of python3, as suggested in ROS discussion
Or try to install yaml with pip3 for python3 (not pip). I think it may help in this situation. See here for installation instructions.

Trying to import a module containing old print statements into new python 3.6

I am trying to import the paraview.simple module from Paraview 5.2 into the new Python 3.6.2 using IDLE. Unfortunately it appears this module is using the old print statement as suggested by this error message:
>>> import paraview.simple
Traceback (most recent call last):
File "<pyshell#50>", line 1, in <module>
import paraview.simple
File "C:\Program Files\ParaView 5.0.1\lib\paraview-5.0\site-packages\paraview\__init__.py", line 129
print text
^
SyntaxError: Missing parentheses in call to 'print'
I really want to use this version of python? There are other modules I wish to use alongside paraview.simple which are only compatible with the latest version of python. How can I circumvent this minor print issue and import the modules I need?
It seems like the question might not be relevant anymore since paraview hasn't been supported for long time (at least there haven't been any pull requests since 2017 https://github.com/Kitware/ParaView/pulls).
For those who still want to use it there is a solution as pointed by #Shashank in the comments: just convert it from python2 to python3 using 2to3 or similar tool.

Installing GIS for gis with Python is easy ...? not for me

I really really need your help please. The fact is my problem should seem pretty simple to you.
So I have a macbook with Lion, I use python 3.3. In order to use GDAL for GIS? I downloaded the package on this website, which is recommended everywhere:
http://www.kyngchaos.com/software/frameworks
Then I install it. It is ok, but I cannot import it in my project, here is my error.
When I type import osgeo, I have the following :
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
import osgeo
ImportError: No module named 'osgeo'
I know my path is not good, wherecan I change it ?
Any ideas?

How do I debug python module loading?

I'm trying to port)cwiid from python 2.7 to 3.2.
It uses a lot of deprecated stuff so I have to change a lot of stuff in order to have it work with 3.2. Right now I'm stuck because of a load error. With a python 3.2 environment and the library installed to the package repo I do:
prompt: echo "import cwiid" | python -
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (PyInit_cwiid)
Besides blind searching in the source code, where does python expect the PyInit_cwiid method?
In the source code for example there is the py_plugin.c which contains a py_init method.

What is wrong with this SimPy installation?

Alright, I have tried a bunch of times the
python setup.py install
command from my command prompt
And when trying this:
from SimPy.Simulation import *
on Idle, I get this:
Traceback (most recent call last):
File "C:/Python30/pruebas/prueba1", line 1, in <module>
from SimPy.Simulation import *
File "C:\Python30\SimPy\Simulation.py", line 320
print 'SimPy.Simulation %s' %__version__,
^
SyntaxError: invalid syntax
>>>
Not every module supports python 3 - in fact, 90% or more of the modules are for 2.x now.
you should use 2.5 or 2.6 for this module, or find a simpy that is compatible with 3.0.
you can also run the 2->3 upgrade script to modify your simpy source, but I don't suggest doing that.
I have a similar error, and I Installed python 2.6.4, so I don't think you can solve your problem using an older version of python.
alumno#ubuntu:/usr/local/SimPy/SimPy$ python carro.py
Traceback (most recent call last):
File "carro.py", line 2, in <module>
from SimPy.Simulation import *
ImportError: No module named SimPy.Simulation
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11)
[GCC 4.4.1] on linux2
Refer point 4 of:
http://pythonhosted.org/SimPy/Manuals/INSTALLATION.html
for a workaround. It worked for me.
simpy package does not seem to have same classes as SimPy by using pip install SimPy command, simpy gets installed.
Hence, just download the SimPy package from the link and copy it to your classpath for python.
There is nothing wrong with your Python installation. SimPy 1 and SimPy 2 use remarkably different syntax from SimPy 3, which is the version that you have installed - and the one which is widely available. The old tutorials are all written in view of the old SimPy versions. Checkout this page...
http://simpy.readthedocs.org/en/latest/simpy_intro/installation.html

Categories