Pyan module throwing error with Python 3.4 version - python

I am doing a static analysis of Python code. The Python version my system has is 3.4.3. When I run the Pyan module to draw call graph, it throws an error in the Pyan code.

pyan relies on the compiler package which has been deprecated since 2.6 and removed in Python3.
There's currently an open ticket on the GitHub project to rewrite pyan for Python 3.
If you were so inclined you could look into updating pyan to use Python3 yourself.

Related

How to detect whether a third-party python package is available on a fixed python version like python3.4

I am embedding python code in my cpp application to provide python-code-runner service. Recently I encountered a problem when I really need to downgrade my python version from 3.8.10 to 3.4.4, so that my application can fit on windows xp.
I used to provided some automatically-installed python 3rd-party packages for my customers to use. Now, as the downgrade of python version, I have to downgrade the 3rd-party packages' version to let my app function fine.
The problem is that I have no idea how to determine whether a 3rd-party package is suitable for python3.4. Is there a way I can test it?
I searched for pypi to get a version suitable for python3.4, but it turns out that this does not work well, as some 3rd-party-libs may rely on other packages with a semanticVersion mark >=.
Take astroid==1.3.8 for an example. I googled and found this version satisfies 3.4.4, so I installed it, and found syntax error when I use import astroid in my python script. The error indicates a syntax error in the lib logilab-common.
File "C:\Python34\lib\site-packages\astroid\__init__.py",line 54, in <module>
from astroid.nodes import *
...... // some traceback
......
File "C:\Python34\lib\site-packages\logilab\common\deprecated.py", line 105
self._proxied: Any = proxied
^
SyntaxError: invalid syntax
It turns out that the package astroid requires logilab-common>=0.63.0, and when I use pip install astroid==1.3.8, it installed the latest logilab-common, which is 1.9.7, and it used a type annotation, which caused this syntax error.
I managed to install logilab-common==0.63.0, and it worked fine when I use import astroid.
Does that mean I can use astroid all fine in python 3.4.4? I am not quite sure whether other functions or apis in this package will raise some syntax error or crash unexpectedly. Is there a way I can test it?
In the case, always installing the minium-satisfied-version of dependency-libs definitely works fine, but that's too much work for me. I want to find a way to test the utility of the libs and their dependency-libs.

Why is my python module not importing ON linux

As you can see I have imported the modules correctly using pip install. I googled a bit why the module was not imported and I realized I have to add it to PATH. I did that too but now there is a new error something about a syntax error
File "pygame/__init__.py",
self.reason = f"{exc_type.__name__}: {self.info}"
Is this because my chrome book can not run Pygame or is the problem something else?
Picture of my terminal with the error:
you need to run python3. to start python 3. Just running python starts python 2.7.
you have your installed packages in python 3.9 version while your python environment is 2.7, look for python3 executable and try with that version

Opencv for python 3.5.2

We seem to be running into a problem downloading opencv which is a dependency for gym-gazebo. Seems opencv works for Python 2.7 but gym-gazebo requires Python 3.5.
We tried fixing it by going into the bash file and tweeking a bit with Python path. We got to a point where opencv can be imported but rospy which is an essential module won't get imported.
We have this error :
ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type
Any advice?
Python modules with binary code need to be built for the specific python version.
Install opencv for python 3.5 using whatever python package manager is on your system (conda / pip etc).
If you are on windows you might want to bookmark Unofficial python builds

pysqlcipher installation on ubuntu with Python 3.4 - syntaxerror

I'm following this tutorial to install pysqlcipher, but get a syntax error.
I'm working on Ubuntu 14.04 LTS. I have created a virtual environment with "virtualenv" to use Python 3.4. Despite the tutorial (of the link above), I cannot success to install sqlcipher! The installation crashes when I run this:
python setup.py build_sqlcipher
The error message is this one:
File "setup.py", line 64
print "CFLAGS", os.environ['CFLAGS']
^
SyntaxError: invalid syntax
The project only works on Python 2; it is not compatible with Python 3.
This specific error shows the project is using the Python 2 print statement, which was removed from the language in version 3. It was replaced by a function to do printing instead.
In all likelihood, fixing this one line is not going to be enough. You'll have to ask the project maintainers if they have any plans in supporting Python 3. I see the project already has a ticket open asking for support, it looks like the project is already working on supporting this, but it is not ready at this point in time.
Instead, install Python 2.7 on your Ubuntu machine and run the code with that version.

Win7/Python3.3: PyLint failed to load its plugins

Good evening! I have installed pylint on python 3.3 and got following problem: at initialization step pylint fails to load plugin modules (from package pylint.checkers). Thanks to debuging I found that problem is in the comand
module = __import__(basename, globals(), globals(), None)
which is executed from __init__.py of the checkers package. basename is correct name of module (file) inside this package but without extension (I have checked this). However ImportError exception is raised. I culdn't step into __import__ function so I don't know what is exact reason of the exception. Is there any way to find out if it is bug of new version of python, incompatibility of pylint and new version of python or my fault (may be in configuring of python or installing of pylint)? My OS is Windows 7.
P.S. Sorry for my weak English. It isn't my native language.
As of 0.26, Python 3.3 is not supported by Pylint. Logilab mainly works with Python 2.x and so help with the most recent 3.x versions is deeply appreciated.
You should approach the team on the python-projects#lists.logilab.org mailing list to discuss this.

Categories