First and foremost, I'm not a very experienced wine user.
Onto the problem. I want to run a Windows executable which in some way or another launches some sort of a python script (presumably, for authorization purposes). In this script, as evident from the error message, an import of "ssl" is present and it fails:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named ssl
I have found that ssl is by default bundled with python 2.6+. I have also found that installing/uninstalling any versions of python inside wine does not fix the issue. Furthermore, I can import ssl inside of wineconsole successfully and also on my linux installation with both python2 and python3.
I don't know how to solve this, but I have a guess that wine pulls python modules from somewhere else, although I haven't been able to find where from exactly and why.
Related
When I run some commands, which work, for example neofetch, it gives me a Python error.
username#host:~$ as
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in <module>
from CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
from CommandNotFound.db.db import SqliteDatabase
File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
It does that whenever I type an invalid command. This started happening after I installed Python 3.9. I am running Kubuntu with Python 3.10 installed by default.
Modern Linux distributions tend to use a lot of python scripts for internal use; for this reason python gets installed with a plethora of libraries.
The error you are getting is because you replaced that fairly complete system python with a version of your own choosing without providing all the libraries the original came with.
The error you see is emitted by /usr/lib/command-not-found, a script using python3 as found in the system path.
I strongly recommend that you re-install the original python packages and use e.g. anaconda for your specific python needs.
The main takeaway from this is:
DON'T MESS WITH THE SYSTEM PYTHON.
try to find which python are you using using which python and uninstall the first python interpreter it finds.
My question is simple: can I install win32com python API (pywin32 notably) on an OS that is not Windows?
I have been trying, on Mac, multiple versions of pip install pywin32, all have failed. An example below:
If you managed to install it on Linux I am also interested as I wrote it.
I am using python 3.7.8.
Thanks.
Win32COM is part of [GitHub]: mhammond/pywin32 - pywin32. According to the (above) URL, the package is only designed to work on Win:
Python for Win32 (pywin32) extensions
So, this is Win specific (it was never intended for other OSes).
As for your question, technically you could install it on Linux, or OSX (it is possible with some manual steps), but that would make absolutely no difference, because (even if installed) it would NOT run on those platforms, as it contains (consists of) binaries (.dlls) that don't run (can't be loaded by processes) on non Win OSes.
Just looked at the comments: [MS.Docs]: Office.MessageCompose interface is available on OSX, but (most likely, if there isn't already a Python wrapper available) you'd have to write the bindings yourself (their examples are in JS).
Additional (generic) information
Some packages are only meant to work in specific conditions, based on restricting criteria like:
Platform(s) (OS, CPU architecture)
Python version(s)
...
even if not enforced by the installation mechanism (meaning they can somehow end up "installed" on platforms that they don't work on).
Anyway, such restrictions are (should be) mentioned (example for PyWin32 - see the red boxes) in package's:
PyPI page
Homepage
Other resources (e.g.: package's doc page, if it has one)
Bottom line is that such a package will not work outside the conditions it was meant to run in (even if it can be installed), and more: when attempting to run it, will yield some error message that might not be very clear.
There are packages with such restrictions, but can be installed outside them:
Win:
ComTypes
Error:
[cfati#cfati-5510-0:/mnt/e/Work/Dev/StackOverflow/q064975918]> python -c "import comtypes"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/cfati/.local/lib/python3.8/site-packages/comtypes/__init__.py", line 28, in <module>
from _ctypes import COMError
ImportError: cannot import name 'COMError' from '_ctypes' (/usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so)
Fix (improvement): [GitHub]: enthought/comtypes - Improve error message on non Win
WConio2
Error:
[cfati#cfati-5510-0:/mnt/e/Work/Dev/StackOverflow/q064975918]> python -c "import WConio2"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/cfati/.local/lib/python3.8/site-packages/WConio2.py", line 125, in <module>
from ctypes import windll
ImportError: cannot import name 'windll' from 'ctypes' (/usr/lib/python3.8/ctypes/__init__.py)
Fix (improvement): [GitHub]: Solomoriah/WConio2 - Improve error message on non Win
I'm rather new to using python and haven't done really anything to configure python. my professor gave us an autograder.py file that checks our python code for correctness. the autograder.py file imports a file called grader.py which then imports something known as cgi (import cgi). inside this cgi file located at '/usr/lib/python2.7/cgi.py' there is a line of code that says
from operator import attrgetter
this is where the problem occurs. i recieve the following error
Traceback (most recent call last):
File "autograder.py", line 12, in <module>
import grading
File "/home/ggkfox/Documents/164-CSCI/1-Assignment/tutorial/grading.py", line 13, in <module>
import cgi
File "/usr/lib/python2.7/cgi.py", line 37, in <module>
from operator import attrgetter
ImportError: No module named operator
it is my understanding that the operator module should be built in (according to other stack overflow posts). this error only occurs when i use python2.7.12 (as opposed to python3.5). i have had a simular issue importing Tkinter in 2.7 aswell.
also i want to say that i have tried uninstalling python using:
sudo apt-get purge python2.7
but it wont even uninstall for me to even attempt to reinstall. im not using any pipenv or desktopenv.
i dont know what else to say, im very new to python coding.
It is almost a necessity to use a virtualenv for each python project.
A virtualenv creates a dedicated python environment and it saves you from a lot of 'operating system' related issues.
Here, you can find some virtualenv solutions compatible with all Python versions, along with the official python 3.6.4 documentation.
I tried installing the deuces package in python using
python -m pip install deuces
which installed perfectly. But whenever I attempt to call upon the function, I get an error message:
Traceback (most recent call last): File "", line 1, in
File
"C:\Python\Anaconda\lib\site-packages\deuces__init__.py", line 1, in
from card import Card ModuleNotFoundError: No module named 'card'
Even though I can't find anything wrong with the module calling. Would someone be able to check what's going wrong here?
PS: I did read the post Import Error Python: No module named 'card' but found no solution.
It seems the package is using python 2 only relative imports here, which was removed py PEP 404.
These should be changed to either douces.xxx or relative imports .xxx. Currently, your best hope would be to make a PR to fix this, or to fork the library and fix it yourself.
You are most likely trying to run this code in Python 3. Sadly the deuces module's page in the PyPI repository does not make it clear that the module currently only appears to support Python 2, under which the module imports perfectly.
Since it doesn't look like the module has received much attention lately, if you want to run it under Python 3 you may end up doing the port yourself. It doesn't look as though it would take too much work.
I am a complete beginner to programming, python, pronterface and 3d printing so unsurprisingly I am having a few difficulties.
I have now managed to download pronterface and get it running on my computer, i think i followed the download instructions correctly and have skeinforge downloaded also in the printrun folder.
My problem is that when I try to open or load a .stl file I get the following:
Skeining C:\Users\James\Downloads\70mm_Faberdashery_Yoda-Lite_less_robe.stl
Skeinforge execution failed.
Traceback (most recent call last):
File "C:\Users\James\Desktop\3d printer software\pronterface\Printrun-d482c66\pronterface.py", line 940, in skein_func
from skeinforge.skeinforge_application.skeinforge_utilities import skeinforge_craft
ImportError: No module named skeinforge_application.skeinforge_utilities
However the file is in the right place I think:
C:\Users\James\Desktop\3dp\pronterface\Printrun-d482c66\skeinforge\skeinforge application\skeinforge utilities\skeinforge_craft
Can you try to explain in plain language any ideas to fix this as I am a total beginner and don't even really know what a module import error is.
Someone on the reprap forms was having a similar issue, the recommendation there is to run skeinforge from the command line.
To solve the problem more satisfactorily, you'd need to check what path is available to python and make sure that the path to the skeinforge module is in your system path or the python path.