Importerror on win32ui for 32 bit Python - python

I've been trying to run a bot for Super Hexagon (Just for fun), but when I try to run the module in IDLE 2.7.11 (32 bit) I get the error
Traceback (most recent call last) :
File "C:\Users(Me)\Desktop\Super-Hexagon-Bot\super_hexagon_bot.py", line 8, in < module >
import win32ui
ImportError: No module named win32ui
Unfortunately, right now I'm streaming my desktop to my Macbook, so I can't copy the code, but here's an image of the part the program has an error with.
I have 64 bit Windows 8, so the win32ui is most likely the problem, but I'm not sure how to change the code to accomodate 64 bit. Any suggestions?

I think the problem is not the the BIT version from your Windows PC.
It seems to me, that you have not installed he module win32ui.
After searching the web, I have found, the module pywin32, which should include all necessary WIN thinks.
You can install it via pip, easy_install of with these MSI installer:
http://sourceforge.net/projects/pywin32/files/pywin32/
Please use the newest and correct version.
But I think you have to change the code:
Sorry I have no Windows PC, so I could not try it, maybe something like that:
from pywin32 import *

It's most likely the Python libraries you are using here, is causing the issue. There is 64 bit build for python win32ui.
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
Download and install one of then and set the build path and import accordingly.

Related

MySQL does not work after installation [duplicate]

I installed Python 3.1 and the Pygame module for Python 3.1. When I type import python in the console I get the following error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import pygame
File "C:\Python31\lib\site-packages\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
It could be due to the architecture of your OS. Is your OS 64 Bit and have you installed 64 bit version of Python? It may help to install both 32 bit version Python 3.1 and Pygame, which is available officially only in 32 bit and you won't face this problem.
I see that 64 bit pygame is maintained here, you might also want to try uninstalling Pygame only and install the 64 bit version on your existing python3.1, if not choose go for both 32-bit version.
Looks like the question has been long ago answered but the solution did not work for me. When I was getting that error, I was able to fix the problem by downloading PyWin32
I had installed Python 32 bit version and psycopg2 64 bit version to get this problem. I installed psycopg2 32 bit version and then it worked.
Had this issue on Python 2.7.9, solved by updating to Python 2.7.10 (unreleased when this question was asked and answered).
Another possible cause of similar issue could be wrong processorArchitecture in the cx_freeze manifest, trying to load x86 common controls dll in x64 process - should be fixed by this patch:
https://bitbucket.org/anthony_tuininga/cx_freeze/pull-request/71/changed-x86-in-windows-manifest-to/diff

How to import pygame.locals successfully

Hello there Stackoverflowers,
I am learning how to program with Pygame and I am trying to import pygame.locals
According to the tutorial I am learning from, I am starting of as such;
import pygame, sys
from pygame.locals import *
I get this error message:
Traceback (most recent call last): File "C:/Python33/test.py", line 2, in from pygame.locals import * ImportError: No module named 'pygame.locals'
I have downloaded Pygame (binary package) for Python 3.2, and I am currently running 3.3.
When I import pygame in the Python shell, no error is returned, and thus I am lead to believe that Pygame was successfully installed.
I am running Windows 7 64 Bit.
I've seen a similar post regarding pygame.locals and Raspberry Pi and Linux, so I think this post is still relevant. Let me know if it is not.
My guess is that you have a file named pygame.py in the current directory in which you are running you script.
I found that on Windows 7 64-bit, you need to get Python 3.3.5, as well as the pygame-1.9.2a0-hg version from Bitbucket.
This solved the problem ImportError: No module named 'pygame.locals' for me.
(Somehow it's a bit weird that the pygame website doesn't provide latest versions of pygame.)
yes #Bartlomiej Lewandowski, you were right.I also faced the same problem and came here to resolve it. I did not download any newer version as apt-get install was giving the message that this is the newest version.
I just renamed my file pygame.py to some other random name.
It is working fine now. So the problem was we named our file as pygame.py, Which is restricted in pygame module, I am not sure. But its working fine now.
Thanks Bartlomiej Lewandowski once again.
For RedHat I needed to install
yum install SDL-devel-1.2.14-7.el6_7.1.x86_64

Can not import Pygame

I am trying to install and use PyGame. I am using Python 3.3.2 and Pygame "3.3 pygame-1.9.2a0" according to the installer. I downloaded it from https://bitbucket.org/pygame/pygame/downloads. I used an easy install, and after next-next type install, I opened the Python 3.3.2 Shell and typed "import pygame". I got this error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
ImportError: No module named 'pygame'
>>> import sys; print sys.path
SyntaxError: invalid syntax
I am also trying to install it with the PyCharm IDE, but I have NO clue how to do that either. The installer I'm using may be for 32 bit, which wouldn't be compatible with my 64 bit installation of Python, but I don't know how to tell and if so is there even a 64 bit version of PyGame for 64 bit? If anyone knows how to install PyGame for Python 3.3.2 please let me know. Thank you for your time.
If your python is a 64 bit version the binary install for the 32 bit will not work. However, there is a 64 bit version here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
If you're worried because they're unofficial don't. I have used many installations from that link for my 64 bit python and they're working great.
Currently, pygame is not available for 64 bit Python (or so it seems on Pygame Site).
The one you installed maybe 32 bit & thus causing the ImportError.
In Python 3.x, print is a function & hence the SyntaxError.
Pycharm for Python 3.x is available Pycharm Download
I would recommend using Python 3.x (32 bit) because most of the libraries seem to be compatible with it & also, 64 bit version doesn't provide much performance benefit as such.
I personally use PyScripter IDE
This maybe very handy at times - Very useful precompiled binaries for several libraries
From pygame website:
windows 64bit users note: use the 32bit python with this 32bit pygame.
So either donwload a 32bit python, then install with the 32bit pygame installer, or download the unofficial 64bit pygame build at here.
Ever time I use PyCharm, I go to File > Settings > Project: (project name) > Interpreter > Plus Icon > (search pygame and click install package) This is because I think that you are using a pycharm venv and I think that that isolates outer packages so I do it this way

"no matching architecture in universal wrapper" when importing pygame

I'm on a MacBook Pro running Snow Leopard 10.6.8 and Python 2.7.2. I went on the pygame website, downloaded and installed all the required frameworks and programs, compiled and installed pygame, but I cant import the module into python. I downloaded an example program off of the pygame website and every time I run it I get this error:
Traceback (most recent call last):
File "/Users/jesse/Downloads/PurpleMines/PurpleMines.py", line 3, in <module>
from pygame import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper
I'm guessing its a problem having to do with running a 64-bit OS?
Thanks in advance for the help.
Removing the old pygame install and reinstalling did the trick for me.
I'm running Mac OS 10.7
sudo rm -Rf /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame
Then copy and install pygame from:
http://www.pygame.org/ftp/pygame-1.9.2pre-py2.7-macosx10.7.mpkg.zip
While what Sylvain said above is correct, this error is often caused by differences in bit rate between python and pygame. It is possible that redownloading it only helps because you get the correct distribution that time. To tell the bit rate of python, do this:
import platform
platform.architecture()
If it is 32 bit, get a 32 bit distribution of pygame. Otherwise, get a 64 bit distribution.

"import wx" fails after installation of wxPython on Windows XP

I downloaded and installed this version of wxPython for use with my Python 2.6 installation:
http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.9.1-py26.exe
When I run Python and try to import wx, I get the following error:
C:\Program Files\Console2>python
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in <module>
from wx._core import *
File "c:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module>
import _core_
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
>>>
I have already tried removing wxPython and installing again and I got the same error. How can I fix this problem?
I was getting the same error.
After some googling found this link to MSVC++ 2008 Redestributable and installed it.
That solved the problem.
Hate to say this, but I had the same problem, and and import worked fine after a reboot.
Copy the Microsoft C runtime library v.9 files and manifest. That is, msvcr90.dll and microsoft.vc90.crt.manifest from folder python to the folder wx, tha is, folder which contains failed to start DLLs.
Or install the Visual C++ 2008 Redistributable Package.
From looking for "application configuration is incorrect" in the wxPython trac system, the only reference that might make sense is a 64-bit vs 32-bit compatibility issue.
Otherwise, I'd say Brian's answer of trying ANSI is pretty good.
BTW, if you try uninstalling again, make go into the site-packages folder and make sure all the wx and wxPython stuff is deleted.
Try the ANSI version instead of the Unicode one. IIRC it needs to match the Python 2.6 install to work properly.
I too have the same issue.Better install "Portable Python" IDE which comes with some nice modules including wxPython .You can start coding GUI immediately without the need to download a separate wxPython.The link ,
http://www.portablepython.com/
Maybe too late, but I had the same problem and solved that by downloading that from their own website : wxPython2.8-win64-unicode-py27
In my case it initially wanted to setup in somewhere else than my python folder. So I changed it to be in ../python27/Lib/SitePackages/
Then it worked properly.
I hope it helps.
Another late answer, but I recently had issues (8/14) and my solution was to use the 32-bit instead of 64-bit wxPython version.
you try to use the module wxpython 2.8.12.1 version, select the version of your python. you can download it here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#wxpython

Categories