PyQt4.QtGui causes DLL Load Error with Python 2.7.5 - python

PyQt4 seems to work fine on Python 2.7.5 running on Windows 8 64bit until now. Using the interactive shell via cmd:
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtGui import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application.
Question: What is causing this issue all of a sudden?

Related

How to run PDFbookmarker in Python

I am trying to use this tool https://github.com/RussellLuo/pdfbookmarker but I am constantly given with error messages.
I installed portable WinPython, installed PyPDF2 via pip, downloaded add_bookmarks.py script and pasted it into WinPython catalogue, changed its execute rights, and just can't run it properly, why?
Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> add_bookmarks.py <test.pdf> [sample_bookmarks.txt] [FILE-new.pdf]
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
add_bookmarks.py <test.pdf> [sample_bookmarks.txt] [FILE-new.pdf]
NameError: name 'add_bookmarks' is not defined
>>>
Eventually I used another one: https://github.com/lstolcman/pdf_bookmarks and it worked.

Python 3 cannot import socket in CMD but available in IDLE

I have installed python 3.7 on my computer. It seems not possible to import socket in CMD:
C:\Users\Sina\py
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python37-32\lib\socket.py", line 49, in <module>
import _socket
ImportError: Module use of python27.dll conflicts with this version of
Python.
>>>
But surprisingly, I am able to import socket in IDLE (Python 3.7).
I searched but didn't find any 'python27.dll' file in the installation directory
of python 3.7 (C:\Python37-32)
EDIT: There was a _socket.pyd file at "C:\Users\Sina" which used to make the confliction. I deleted it and the problem got fixed. Thanks to Aran-Fey!

no module named matplotlib on windows

Facing this issue right now, saw the question:
no module named pylab on windows
I have annaconda and python 2.7 installed. I tried in the python shell:
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib
and received the following result. I've checked my PATH variable, and I'm not sure how to resolve.
Thanks in advance.

ImportError: DLL load failed with downloaded PYQT4. 64bit python2.7

I am going to run a GUI program with main.py
After I run the main.py with using cmd, it shows the result.
Traceback (most recent call last):
File "Main.py", line 1, in <module>
from MainGlobalVar import *
File "C:\G02FYP\MainGlobalVar.py", line 4, in <module
from NetworkConsole import *
File "C:\G02FYP\NetworkConsole.py", line 1, in <modul
from PyQt4.QtGui import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
I have double-checked that my version is 64 and I have re-installed the PYQT4
with using 64bits and python 2.7.9
Moreover,if I type python in cmd, it shows:
C:\>python
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>>
What should i do for this importerror.

“ImportError: No module named scipy” after installing the scipy package

I need help with the scipy Python module. I installed it, but when I try to import it, I get an error (no module named scipy). Why?
Here's the output from my Python interpreter:
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import scipy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import scipy
ImportError: No module named scipy

Categories