cx_freeze error with pyodbc - pyodbc

if you have a simple program name pyodbcTest.py
import pyodbc
print "pass"
and then use cx_freeze to compile it
cxfreeze --targe-dir=cxTest pyodbcTest.py
and then run that program it throws the following error.
C:\temp\pythonWork\cxTest>pyodbcTest.exe
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec code in m.__dict__
File "pyodbcTest.py", line 1, in <module>
RuntimeError: Unable to import decimal
Any ideas?

I had to add the option --include-module decimal to solve the problem. Not sure why it could not find that one on its own during the freeze process, but its working now

Related

How do I fix Issue running pexpect-serial example

Pexpect serial https://pypi.org/project/pexpect-serial/ throwing an exception while running example. This in on windows. How do I fix?
import serial
from pexpect_serial import SerialSpawn
Traceback (most recent call last):
File "", line 1, in
File "C:\python36\lib\site-packages\pexpect_serial_init_.py", line 1, in
from .serial_spawn import SerialSpawn
File "C:\python36\lib\site-packages\pexpect_serial\serial_spawn.py", line 24, in
from pexpect import spawn
ImportError: cannot import name 'spawn'
found an alternative project that works on windows
pexpect-serial-terminal

Pyueye IDS Camera

I am working with IDS camera and they have a python module called pyueye. I installed it using pip, but it seems like the dll are missing:
Traceback (most recent call last):
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/dll.py", line 166, in load_dll
dll = DLL(libinfo, libnames, os.getenv(envname))
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/dll.py", line 96, in __init__
raise RuntimeError("could not find any library for {} ({})".format(libinfo, dllmsg))
RuntimeError: could not find any library for ueye_api (DLL_PATH: unset)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/bikram/Documents/uEye/1.py", line 1, in <module>
from pyueye import ueye
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/__init__.py", line 56, in <module>
from . import ueye
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/ueye.py", line 58, in <module>
get_dll_file, _bind = load_dll("ueye_api", ["ueye_api_64", "ueye_api"], "PYUEYE_DLL_PATH")
File "/home/bikram/.local/lib/python3.8/site-packages/pyueye/dll.py", line 168, in load_dll
raise ImportError(exc)
ImportError: could not find any library for ueye_api (DLL_PATH: unset)
I noticed someone else had the same issue in windows.
Does anyone else have the same issue using pyeue?
I had same issue but then I downloaded IDS Software Suite from https://en.ids-imaging.com/
Installed it and everything worked. Give it a try.
It will also let you configure their camera from IDS Camera Manager before you use it from Python.

Why do I get an error message although I have installed thonny sqlite3 correctly

I want to use thonny sqlite3. I am installing sqlite3 module with Thonny Manage Packages.But after typing import sqlite3, when I want to run it in this state, it gives the following error message:
File "<stdin>", line 3, in <module>
File "/lib/sqlite3.py", line 11, in <module>
AttributeError: 'NoneType' object has no attribute 'func'
Thank for your help.

Jupyter will not launch from Anaconda Navigator 32bit

I read where running installing pyqt5 or pip install pyqt5 would correct this error. Did not work for my enviornment. Any suggestions?
Traceback (most recent call last):
File "C:\Users\Paula\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 10, in
import sqlite3
File "C:\Users\Paula\Anaconda3\lib\sqlite3\__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Users\Paula\Anaconda3\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Paula\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "C:\Users\Paula\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 86, in
from .services.sessions.sessionmanager import SessionManager
File "C:\Users\Paula\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 13, in
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'

Spyder not working after installation of other packages

In summary: as far as I recall, after conda-installing fenics and sfepy (along with, through pip, some dependencies), I cannot run spyder:
$ spyder
Traceback (most recent call last):
File "/home/charles/anaconda3/lib/python3.5/site-packages/qtpy/QtWebEngineWidgets.py", line 22, in
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: No module named 'PyQt5.QtWebEngineWidgets'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/charles/anaconda3/bin/spyder", line 6, in
sys.exit(spyder.app.start.main())
File "/home/charles/anaconda3/lib/python3.5/site-packages/spyder/app/start.py", line 103, in main
from spyder.app import mainwindow
File "/home/charles/anaconda3/lib/python3.5/site-packages/spyder/app/mainwindow.py", line 92, in
from qtpy import QtWebEngineWidgets # analysis:ignore
File "/home/charles/anaconda3/lib/python3.5/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ImportError: /usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5: version `Qt_5' not found (required by /home/charles/anaconda3/lib/python3.5/site-packages/PyQt5/QtWebKitWidgets.so)
Along the method of
https://www.scivision.co/fix-spyder-cxxabi-not-found-qt-error/
Would it be a terrible idea to simply copy
/usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5
to
~/anaconda3/lib/
a la
cp /usr/lib/x86_64-linux-gnu/libQt5WebKitWidgets.so.5 ~/anaconda3/lib/
?
I'm paranoid about breaking something, is there a high probability of that happening?
Surely there's a better way to do this, no?
Thanks!

Resources