Library subprocess throws Windows Error "not a valid Win32 application" [duplicate] - python

This question already has answers here:
Using subprocess to run Python script on Windows
(8 answers)
Closed 8 years ago.
Hence I was writing this py program.
import subprocess
string="ihateminority.py"
process=subprocess.Popen(string,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
res=process.communicate("3 5")
print res[0]
And I got this Window Error.
Obviously, the error came from the library, not me. Is there anyway to fix this, or just simply avoid id. (I cant use external library)

That's because "ihateminority.py" is not a valid Win32 application. You should call "python.exe" and pass it "ihateminority.py" as an argument.

Related

Pyinstaller cannot import pynput module [duplicate]

This question already has answers here:
Getting error when using pynput with pyinstaller
(2 answers)
Closed 8 months ago.
Hey ive tried coding a script in which i use pynput to detect keybinds being pressed. It works fine itself but sadly once i try to use pyinstaller to make it into an exe file the following error pops up once i try to run it.
I have tried looking up the problem but have not found any working solutions.
I have also read through pyinstaller's documentation but I didn't find anything.
#use this pip install pynput==1.6.8

How can I identify whether a file is written in Python2 or Python3? [duplicate]

This question already has answers here:
Any check to see if the code written is in python 2.7 or 3 and above?
(2 answers)
Closed 1 year ago.
I want to check whether each file in a list of files is written in Python2 or Python3. This would greatly improve productivity and would allow teams to see what files are running on old versions of Python or new versions.
Can this be done?
import subprocess
import exceptions
try:
subprocess.run(["python2", "-m py_compile foo.py"])
except ValueError, e:
# pyhon3 or bad code
if python2 can compile the code, it means it is a python2 compilable file, we may assume it is a python2 file.
you can also check if it is a python3 in except block. just replace python2 to python3

Import error open for cvlibrary-python [duplicate]

This question already has answers here:
ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there
(24 answers)
Closed 5 years ago.
Can anyone explain what does this error means and what I have to do to fix it?Error
Install 64 bit version of cv2.
P.S. I would recommend that you go through the guidelines for writing good questions on SO.

Win32 vs Win32api [duplicate]

This question already has answers here:
Python 3.4 :ImportError: no module named win32api
(7 answers)
Closed 6 years ago.
I downloaded pywin32 (using pip), and want to use the win32api, however, the module doesn't exist. win32 exists and win32com exist, but not win32api. How can I access win32api(specifically I want to be able to access the GetVolumeInformation) function.
Figured it out, win32api is part of win32, so I just changed the import to win32.win32api.

set pyrouge_set_rouge_path error [duplicate]

This question already has answers here:
pyrouge: 'pyrouge_set_rouge_path' is not recognized as an internal or external command
(2 answers)
Closed 5 years ago.
I have Windows 7 and use Python 3.4
I'm trying to work with ROUGE installing pyrouge from pypi.
I followed the installation steps on the site https://pypi.python.org/pypi/pyrouge/0.1.2
But the command:
pyrouge_set_rouge_path /absolute/path/to/ROUGE-1.5.5/directory
doesn't execute.
I try in the command prompt:
pyrouge_set_rouge_path C:\rouge
and the error:
'pyrouge_set_rouge_path' is not recognized as an internal or external command, operable program or batch file.
I would greatly appreciate if you can help me with something.
Thanks
I asked the same question for Python 2.7 in stackoverflow, and received the following answer:
set pyrouge_set_rouge_path=C:\rouge
This worked for me.

Categories