I need to use M2Crypto in my python script. I downloaded the M2Crypto windows installer from: https://pypi.python.org/pypi/M2CryptoWin64
When I imported the M2Crypto in my script using: import M2Crypto and run my script, I get errors.
Traceback (most recent call last):
File "C:/Users/xxx/PycharmProjects/TLSscanner/scanner_v2.py", line 4, in <module>
from M2Crypto.Err import SSLError
File "C:\Users\xxx\PycharmProjects\TLSscanner\M2Crypto\__init__.py", line 22, in <module>
import __m2crypto
ImportError: No module named '__m2crypto'
I do not know where to place the M2Crypto folder after I installed it and extracted it? Can you clarify to me where packages need to be placed in order for the script to run?
EDIT:
This is the successful installation path. Shall I put my python script in the same path? The error I get when running my script (in another folder for the project) is shown above.
Related
I am trying to import a python module from a certain folder. This is the code:
import sys
sys.path.append(r"C:\path\to\module_foobar")
import foobar
In a miniconda env with all prerequisites installed (python 3.10 and numpy), I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing foobar: The specified procedure could not be found.
But with the system python in cmd, the same code works.
Tried adding the path to system path variable as well as specifying it in a custom .pth file in the site-packages folder of the miniconda environment.
Tried running dependencywalker on the .pyd file of the package and it says that a bunch of MS C++ Redistributeable dll files seem to be missing. Tried repairing those to no avail.
What on earth could be wrong?
I am trying to use httplib2 in Python 2.7 on Windows 7 using the IDLE PythonWin 32 build 219.
I downloaded it and installed using python setup.py install method.
On Windows command line the following is successful:
python
import httplib2
httplib2
<module 'httplib2' from 'C:\Python27\ArcGISx6410.2\lib\site-packages\httplib2-0.9.2-py2.7.egg\httplib2\__init__.pyc'>
Here's the problem: in PythonWin importing httplib2 returns:
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named httplib2
I added the location of the module returned in command line (above) using sys.path.append in command line hoping that would resolve the issue.
PythonWin still cannot import the module, and sys.path in PythonWin does not return the appended path to httplib2. I appended the path the same way in PythonWin, but still could not import the module, and when I reopened PythonWin, the path did not cotain the appended module anymore.
Why or how could PythonWin be using a different path, and how can I get PythonWin to be able to import httplib2?
Have you tried using the command line tool pip ? You can use it like so:
pip install httplib2
That should put it on your path. If you don't have pip installed see this post. Also, worth mentioning, httplib2 is not as friendly as requests which I personally prefer.
Im a trying to build a COM server in Python. I have downloaded and installed Pywin32 (I use 32-bit version of Python 3.4.1, so I downloaded and installed pywin32 for this version).
Now, in order to import pythoncom in IDLE, I need to have two .dll files readily accessible:
-pythoncom.dll
-pywintypes.dll
Both .dll files are in the following directory:
C:\Python34\Lib\site-packages\pywin32_system32
When I give the import statement in IDLE, I get the following error:
Traceback (most recent call last):
File "", line 1, in
import pythoncom
File "C:\Python34\lib\site-packages\pythoncom.py", line 2, in
import pywintypes
ImportError: No module named 'pywintypes'
I reinstalled pywin32, but it still doesn't fix it.
I am now trying to add C:\Python34\Lib\site-packages\pywin32_system32 to my PATH directory, but it doesn’t work. I am trying this via:
os.environ["PATH"] += os.pathsep + C:\Python34\Lib\site-packages\pywin32_system32
I then get the following message:
The syntax of the command is incorrect.
What error am I making in the syntax above? How can I fix this (i.e. how can I add C:\Python34\lib\site-packages\pythoncom.py to my PATH environment)?
I'm new to python.
I'm working in windows environment. mostly win7.
My machine is win7 32bit also.
I downloaded the wmi module and used the .exe to install it.
when I try and 'import wmi', i get an error:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
import wmi
File "C:\Python33\lib\wmi.py", line 88, in <module>
from win32com.client import GetObject, Dispatch
ImportError: No module named 'win32com'
How can I solve this? Does win7 compliant with this module?
Regards
download WMI-1.4.9.win32.exe from https://pypi.python.org/pypi/WMI/ and it will resolve your problem
Instead you can also install win32com which would resolve the issue.
To install win32com use:
pip install pypiwin32
What worked for me is:
i downloaded the source named: WMI-1.4.9.zip from https://pypi.python.org/pypi/WMI/
Extracted all files from that zip file and saved it in a folder named: WMI-1.4.9 and then copied that folder to C:\Python27\Lib\site-packages.
After that I navigated to that folder C:\Python27\Lib\site-packages\WMI-1.4.9 and did a shift + right click -> Open Command line here and ran: python setup.py install
That's it, after that it worked for me like charm. No issues.
p.s - While installing exe I had some weird Access Denied errors, I tried by running the exe as Administrator even then I could get through it. Hence that didn't at all work for me.
Also I had pywin32 installed from here:
http://sourceforge.net/projects/pywin32/files/ (select the correct file - 'bittedness' and python version wise)
I installed wmi with the installer here http://timgolden.me.uk/python/wmi/index.html
but I can't get the module to import.
Here is my code:
import wmi
c=wmi.WMI()
for os in c.Win32_OperatingSystem():
print(os.Caption)
and here is the error:
Traceback (most recent call last):
File "C:/Python33/Programs/WMI trial.py", line 1, in <module>
import wmi
File "C:\Python33\lib\site-packages\wmi.py", line 88, in <module>
from win32com.client import GetObject, Dispatch
ImportError: No module named 'win32com'
Any idea why this isn't working? I have a 64 bit system but that hasn't affected running 32 bit python at all.
Any help is greatly appreciated!
you are missing the 'Python For Windows Extensions' (pywin32).
WMI module requires pywin32.
run the appropriate installer for pywin32, then try WMI again.
The "No module named 'win32com'" error is because it can't find the winm32com module (which is installed as part of pywin32 package.)
What worked for me is:
i downloaded the source named: WMI-1.4.9.zip from https://pypi.python.org/pypi/WMI/
Extracted all files from that zip file and saved it in a folder named: WMI-1.4.9 and then copied that folder to C:\Python27\Lib\site-packages.
After that I navigated to that folder C:\Python27\Lib\site-packages\WMI-1.4.9 and did a shift + right click -> Open Command line here and ran: python setup.py install
That's it, after that it worked for me like charm. No issues.
p.s - While installing exe I had some weird Access Denied errors, I tried by running the exe as Administrator even then I could get through it. Hence that didn't at all work for me.
Edit:
Also I had pywin32 installed from here:
http://sourceforge.net/projects/pywin32/files/ (select the correct file - 'bittedness' and python version wise)