Snap7 module not found with python .exe - python

I'm using Pycharm to create a simple program that uses snap7 lib. to read a S7-1200 PLC, it works correctly when i run it with Pycharm but when i try to run it with an .exe file it prompts this error message:
Traceback (most recent call last):
File "main.py", line 1, in
ModuleNotFoundError: No module named 'snap7'
the snap7.dll and .lib are both in sys32 folder aswell as in environment variables PATH route.
both the python file and my PC are x64 so i used the x64 version of the DLL and lib files.
What am i missing?

How did you install the snap7 library?
py -m pip install python-snap7 is the way i installed it. I never had any problems with it.

Related

Cannot use the package "openexr" in python within Blender

I've installed the "openexr" package within my windows system. To do this, i used powershell from my blender installation folder "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python" to launch the command ".\bin\python.exe -m ensurepip", for installing pip, and then "pip install openexer" to install the package.
Everything seems fine, but when I open blender and start to code with a simple
import openexr
I obtain this error:
Traceback (most recent call last):
File "\Text", line 1, in <module>
ModuleNotFoundError: No module named 'openexr'
Error: Python script failed, check the message in the system console
The module seems installed, but it's like blender cannot access it. Someone can help me? I would be extremely happy if this could work !
At the moment I tried to re-install pip or the openexr package, but the problem persist.
Also, if I try to re-install openexr, the system answer me that the package is already installed.

ModuleNotFoundError with pyinstaller but fine in Pycharm

I'm trying to convert a .py project to an .exe file using the using the Auto Py To Exe which uses the pyinstaller.
Running my code inside pycharm I get no errors. Running the .exe file i'm getting the error:
Traceback (most recent call last):
File "objectGui.py", line 6, in <module>
ModuleNotFoundError: No module named 'scipy'
[19724] Failed to execute script objectGui
I've tried adding following bit of code to the conversion
--hidden-import scipy
This does not change the error I keep getting.
Any suggestions?
I have found the solution in
this post.
Since I worked on my project in an environment (PyCharm) I needed to type in the command in the PyCharm terminal for it to work. I also added the hidden import:
--hidden-import scipy
to find the module and it worked!

Module can be imported in the terminal, but not IDLE

Recently, when I use pip to install python modules, I will get an error saying that the module has not been downloaded when I run it in the IDLE. However, when I run the same script in the terminal, it works fine. What is this error and how can I solve it?
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import gspread
ModuleNotFoundError: No module named 'gspread'
Probably you have different versions of python installed.
The version you used pip to install new modules is different from the version you access with IDLE.

Pylucene 4.9.0 Ubuntu 14.04 Installation ImportError

I've been trying to install Pylucene on my Mac for a little over a week, and have given up on that in favor of trying to install it with Ubuntu through a virtual machine. I thought the installation process had gone well, so I fired up Python in the terminal and tried to import lucene and received the following ImportError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/parallels/anaconda/lib/python2.7/site-packages/lucene/__init__.py", line 7, in <module>
import _lucene
ImportError: libverify.so: cannot open shared object file: No such file or directory
So, it looks like there is a module _lucene that does not exist. But I thought this would have been part of what I had just installed? Any insight here would be appreciated.
I had to add extra paths to my LD_LIBRARY_PATH environment variable to get things working. The test here in the conda build script actually shows those variables.
export LD_LIBRARY_PATH=$PREFIX/lib:$PREFIX/jre/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/jre/lib/amd64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/jre/lib/amd64/server:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PREFIX/lib/python2.7/site-packages:$LD_LIBRARY_PATH
$PREFIX here is the path to the anaconda folder. I currently install miniconda at /usr/conda on my systems.

no module named pywinauto

when I type the following on python2.5 IDLE (windows vista 32-bit)--
from pywinauto import Application
I get this error message--
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pywinauto
ImportError: No module named pywinauto
I followed the instructions from this site, and did not get any error message during installation. What did I not get right here?
Thanks!
Do you have multiple versions of Python installed? Maybe the python.exe that was used for python.exe setup.py install is not Python 2.5. To check, open a command prompt and run python.exe -V.
If that is the problem, you need to go to the directory where you extracted the pywinauto zip file, and run C:\python25\python.exe setup.py install

Categories