script from python 3.5 to 2.7 [duplicate] - python

I can't make this .py .exe help me.
i have python34 installed on windows 7 - 32 bits
This is a Snake.py simple game and i can't convert it using py2exe.
i looked in google and stackoverflow and everywhere else but couldn't fix it.
i get this error when trying to convert the script.
The error: http://pastebin.com/uRHpg1B8
And this is my game: http://pastebin.com/R6A89Nhe

Well, based on your error output, it looks like you are missing several packages which are important for pygame to function. Error output duplicated below, for future reference.
8 missing Modules
------------------
? MacOS imported from pygame.macosx
? Numeric imported from pygame
? OpenGL imported from pygame
? Py25Queue imported from pygame.threads
? Queue imported from pygame.threads
? numpy imported from pygame, pygame._numpysndarra
y, pygame._numpysurfarray
? packaging imported from pkg_resources
? readline imported from cmd, code, pdb

Related

Paraview: paraview.simple import, all paths are set

I am trying to run a simple python program, importing the paraview.simple module:
from paraview.simple import *
I get the following error:
Error: Could not import vtkCommonComputationalGeometry
I looked at similar posts on different fora and tried everything that was suggested there, but nothing worked for me. My Python path includes:
ParaView-5.7.0-MPI-Linux-Python2.7-64bit/bin/
ParaView-5.7.0-MPI-Linux-Python2.7-64bit/lib
ParaView-5.7.0-MPI-Linux-Python2.7-64bit/lib/python2.7/site-packages/
My LD_LIBRARY_PATH includes:
ParaView-5.7.0-MPI-Linux-Python2.7-64bit/lib/python2.7/site-packages/vtkmodules/
Does anybody know how to fix it?
Update:
I think there is an underline issue regarding the Unicode variant my python interpreter is using. I now get the following error:
Unicode error
ImportError: /home/nick/ParaView-5.7.0-MPI-Linux-Python2.7-64bit/lib/python2.7/site-packages/vtkmodules/vtkCommonCorePython.so: undefined symbol: PyUnicodeUCS2_DecodeUTF8
Does anybody know a fix?
You may want to use the pvpython program that is bundled with ParaView. It is basically a python interpreter but already setup with the correct paths.
If you want to use an external interpreter, you have to setup the PYTHONPATH environment variable to ParaView-5.7.0-MPI-Linux-Python2.7-64bit/lib/python2.7/site-packages/ and the LD_LIBRARY_PATH (on linux, PATH on windows) to ParaView-5.7.0-MPI-Linux-Python2.7-64bit/lib.
See also the ParaViewTutorial pdf from the download page (https://www.paraview.org/download/), at 3.1 Starting the Python Interpreter

Python module "preprocess" - does that exist?

In my python code I want to use a module called "topicmodels" (that can be found here https://github.com/sekhansen/text-mining-tutorial). The problem with this module is that whenever I want to "import topicmodels" in my Python code, I get the error message:
ImportError: No module name preprocess, more specifically in that topicmodels module is a Python file init.py that contains the line " from preprocess import * ". I googled and did not find a python module called preprocess - can anybody help me out on this?
(I am using Kubuntu and Python 3.5.2 | Anaconda 4.2.0).
Thanks a lot for any help!
This code is written for Python 2. You're on Python 3. The failing import is an implicit relative import, which Python 3 prohibits.
Run it on Python 2.
pip install preprocessing
Reference: https://pypi.org/project/preprocessing/

Python: ImportError from compiled source code

I'm having problems while running a compiled source code. The code itself is correct and if I run python file.py everything goes fine; if I compile it with pyinstaller or software like this, and then I run the compiled file it says ImportError: No module named _cffi_backend. But when I open python and import cffi and/or _cffi_backend python doesn't show error. Investigating in my code I found that the problem is just with padding from cryptography, so if I don't import padding the output doesn't show errors (obviously errors comes because the code doesn't work well without padding module).
Can someone help me?
I just ran into this issue as well.
What worked for me was adding in --hidden-import=_cffi_backend option when building with pyinstaller.

Python, pygame, py2exe

I can't make this .py .exe help me.
i have python34 installed on windows 7 - 32 bits
This is a Snake.py simple game and i can't convert it using py2exe.
i looked in google and stackoverflow and everywhere else but couldn't fix it.
i get this error when trying to convert the script.
The error: http://pastebin.com/uRHpg1B8
And this is my game: http://pastebin.com/R6A89Nhe
Well, based on your error output, it looks like you are missing several packages which are important for pygame to function. Error output duplicated below, for future reference.
8 missing Modules
------------------
? MacOS imported from pygame.macosx
? Numeric imported from pygame
? OpenGL imported from pygame
? Py25Queue imported from pygame.threads
? Queue imported from pygame.threads
? numpy imported from pygame, pygame._numpysndarra
y, pygame._numpysurfarray
? packaging imported from pkg_resources
? readline imported from cmd, code, pdb

Missing multiprocessing module when freezing Python code

I'm using cx_Freeze to freeze my Python code so I can distribute it as executable on Windows systems. It works fine but it's missing a few modules. I use some open-source libraries in my project e.g. BeautifulSoup and Periscope. They use some libraries for backward compatibility which i don't need to include as Python 2.6 has them. The problem is the third import — multiprocessing._multiprocessing. Can anyone tell me what I need to install in order to fix this? The mutiprocessing module seems to come bundled with Python so what's causing this error?
Missing modules:
? cjkcodecs.aliases imported from BeautifulSoup.BeautifulSoup
? iconv_codec imported from BeautifulSoup.BeautifulSoup
? multiprocessing._multiprocessing imported from multiprocessing.forking
? xdg.BaseDirectory imported from periscope.periscope
Any help?
Thanks guys!
There was a similar issue on Google App Engine. See this
I fixed this my putting a _multiprocessing.py file into the multiprocessing module's folder. This file contained the code:
import multiprocessing
This works but it isn't a robust answer.

Categories