After successful installation on Pylint on my Windows OS, I am able to run it on command prompt to check any python file.
But when I integrate PyLint on Wing IDE v 5.0, I am getting below error on checking any python file
Error executing PyLint: Command failed with error=None, status=2; stderr:
python: can't open file 'C:\Python27\Scripts\pylint': [Errno 2] No such file or directory
Am I missing something to install or pre-configure. I have set the location of Pylint.bat in PATH variable already.
Related
I have an issue globally on my iMac ( M1 incase it matters )
where the commands exit with import ansible module is missing
So I tried installing a tmp dir with virtual env and tried using Ansible from there w/o luck.
I'll start from the error:
$ ../venv/bin/ansible-inventory
ERROR: [Errno 21] Is a directory: '/private/tmp/testansible/z'
File structure is like this:
~/$ cd /tmp
tmp$ mkdir testansible && cd $_
testansible$ mkdir z
testansible$ virtualenv venv
testansible$ venv/bin/pip3 install ansible
Then in a different directory i'm trying to use it:
testansible$ cd z
z$ ../venv/bin/ansible-config init > ansible.cfg
Then running any ansible command gave me tons of errors:
ERROR: Invalid settings supplied for DEFAULT_GATHER_TIMEOUT
ERROR: Invalid settings supplied for DEFAULT_NULL_REPRESENTATION
ERROR: Invalid settings supplied for DEFAULT_REMOTE_PORT
ERROR: Invalid settings supplied for GALAXY_IGNORE_INVALID_SIGNATURE_STATUS_CODES
Which is strange by itself because their comments says that if there's no value - it will take some default from somewhere
Each one I "resolved" by commenting them out
Then the command worked:
z$ ../venv/bin/ansible-config init > ansible.cfg
But every other ansible command i'm trying to execute gives the same error:
z$ ../venv/bin/ansible -i inventory.hosts
ERROR: [Errno 21] Is a directory: '/private/tmp/testansible/z'
z$ ../venv/bin/ansible-inventory -i inventory.hosts
ERROR: [Errno 21] Is a directory: '/private/tmp/testansible/z'
Any ideas ?
Edit
Thanks to the comment below the issue was this line in the ansible.cfg file:
# (path) File to which Ansible will log on the controller. When empty logging is disabled.
log_path=
Commenting out this line - and the ansible commands started working.
I'm not sure , why across the file it says: When empty logging is disabled - but it's not disabled, it throws an exception. so as all the above variables, they don't really have a default value - they are just getting in the way
I'm trying to run a python script in WSL that runs Ubuntu.
In WSL, the following command does not work:
admin:/mnt/c/Users/admin$ /mnt/c/Users/admin/repo/env/Scripts/python.exe /mnt/c/Users/admin/repo/script.py
C:\Users\admin\AppData\Local\Programs\Python\Python38-32\python.exe: can't open file '/mnt/c/Users/admin/repo/script.py': [Errno 2] No such file or directory
However, the following individual commands work:
admin:/mnt/c/Users/admin$ /mnt/c/Users/admin/repo/env/Scripts/python.exe repo/script.py
admin:/mnt/c/Users/admin$ /mnt/c/Users/admin/repo/env/Scripts/python.exe
admin:/mnt/c/Users/admin$ cat /mnt/c/Users/admin/repo/script.py
Why am I seeing this strange behavior? How do I run a python script using absolute path?
I am attempting to use cx_Freeze as an alternative to my usual application for converting .py to .exe (auto-py-to-exe). When I run it in cmd I get:
C:\WINDOWS\system32>cxfreeze-quickstart
Project name: FE
Version [1.0]: 1.0
Description: File Edit and more!!!
Python file to make executable from: File Create.py
Executable file name [File Create]: FileCreateExe
(C)onsole application, (G)UI application, or (S)ervice [C]: C
Save setup script to [setup.py]: C:\Users\tom\Documents\python\_Thiswill createfiles_
Overwrite C:\Users\tom\Documents\python\_Thiswillcreatefiles_ [n]? yes
Traceback (most recent call last):
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\tom\AppData\Local\Programs\Python\Python38-32\scripts\cxfreeze-quickstart.exe\__main__.py", line 7, in <module>
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\cx_Freeze\setupwriter.py", line 101, in main
writer.Write()
File "c:\users\tom\appdata\local\programs\python\python38-32\lib\site-packages\cx_Freeze\setupwriter.py", line 64, in Write
output = open(self.setupFileName, "w")
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\tom\\Documents\\python\\_This will create files_'
As you can see I am running my command prompt as administrator since I got the same error when running it normally. What can I do to fix this error? PermissionError: [Errno 13] Permission denied: 'C:\\Users\\tom\\Documents\\python\\_This will create files_'. I can not find any other sites that explain how to fix this. Why does this error occur? Please can I have some help... 😁😁😁
dude you are running the command from system32
cd to another directory using this command and try again
cd C:/Users/<your name>/Documents
if this doesnt work go here
Step 1: Add Python to Windows Path
Step 2: Open the Windows Command Prompt as administrator
Step 3: Install the Pyinstaller Package
In the Windows Command Prompt, type the following command to install the pyinstaller package (and then press Enter):
pip install pyinstaller
Step 4: Save your Python Script
I then saved the Python script in the following folder:
C:\Users\Ron\Desktop\MyPython
Where I named the Python script as ‘hello’
Step 5: Create the Executable using Pyinstaller
Now you’ll be able to create the executable from the Python script using pyinstaller.
Simply go to the Command Prompt, and then type:
cd followed by the location where your Python script is stored
In my case, I typed the following in the command prompt:
cd C:\Users\Ron\Desktop\MyPython
Next, use the following template to create the executable:
pyinstaller --onefile pythonScriptName.py
Since in our example, the pythonScriptName is ‘hello‘, then the command to create the executable is:
pyinstaller --onefile hello.py
Once you’re done, press Enter for the last time.
Step 6: Run the Executable
Your executable should now get created at the location that you specified.
In my case, I went back to the location where I originally stored the ‘hello’ script
(C:\Users\Ron\Desktop\MyPython).
Few additional files got created at that location. To find the executable file, open the dist folder:
Now I hope that solves the question..
Read this doc. Create a setup.py file in your project directory and copy the content from the docs into it.
Modify it as necessary, then run python setup.py build inside your project directory.
I am trying to run a python programme called helloWorld.py from the command line on MacOS.
I am typing into bash:
Ryans-MacBook-Air:~ ryanunderwood$ python3 helloWorld.py
But I am getting the following:
/Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'helloWorld.py': [Errno 2] No such file or directory
There is definitely a file with this name in the directory. Why is this programme not running?
Try ./helloworld.py or python3. /hello World.py
And make sure you have the right permissions
After downloading the precompiled binaries for Windows of the openALPR library, running the setup.py included in the source code to install it, and running the python_test.bat included in the precompiled binaries directory I get the following error:
File "C:\Users\rhenriquez\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openalpr\openalpr.py", line 51, in __init__
self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalprpy.dll")
File "C:\Users\rhenriquez\AppData\Local\Programs\Python\Python37-32\lib\ctypes\__init__.py", line 434, in LoadLibrary
return self._dlltype(name)
File "C:\Users\rhenriquez\AppData\Local\Programs\Python\Python37-32\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: OSError: [WinError 193] %1 is not a valid Win32 application
When I started to run the script at first the error was WinError 126 and then I noticed that the dll that the script was trying to call (openalprpy.dll) didn't had "lib" at the beginning of its name, so I added it to the dll's name. Then it started to send me WinError 193, and I've been clueless on what else to do or what am I doing wrong from then on.
Any help would be appreciated.
EDIT: So I tried this with the 32-bit version and it gives the same error you are encountering. This appears to be an issue with trying to import a 32-bit .dll while using 64-bit python, or vice-versa, as seen in Python Ctypes Load Library
/EDIT
I did get it to work on my system... with a few modifications, this package is not as "plug and play" as it should be.
I don't know where I went right, so I'll just list what I did:
Download the pre-compiled biniaries from releases (I used openalpr-2.3.0-win-64bit.zip) https://github.com/openalpr/openalpr/releases
Download the project itself, https://github.com/openalpr/openalpr
Unzip both.
Goto the bindings folder in openalpr-master cd C:\openalpr-master\openalpr-master\src\bindings\python and run python setup.py install to make the bindings.
Then navigate to the project folder in site-packages, most likely C:\Users\rhenriquez\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openalpr\ and open openalpr.py in IDLE,
here you can change line 51 from self._openalprpy_lib = ctypes.cdll.LoadLibrary("libopenalprpy.dll") to self._openalprpy_lib = ctypes.cdll.LoadLibrary("openalprpy.dll") since it appears other links are broken if you change the file name.
I also found it beneficial to change line 90 to except Exception: since it did not want to import correctly and was not raising an ImportError.
After that the python_test.bat worked correctly.
Namespace(config='openalpr.conf', country='us', plate_image='samples/us-1.jpg', runtime_data='runtime_data')
Using OpenALPR 2.3.0
Image size: 497x372
Processing Time: 561.825989
Plate #1
Plate Confidence
- THECAR 92.207481
- THEGAR 81.348961
- HECAR 80.229317
- TMECAR 78.159492
- THE0AR 77.702461
- THECAB 77.389000
- THEAR 76.510017
Press any key to continue . . .