How to download python linter in vscode with this error - python

its a very dummy question but i couldn't figure it out. When i try to download a linter from vscode the problem shows up
C:\Users\burak kaya\AppData\Local\Programs\Python\Python37\python.exe: can't open file 'c:\Users\burak': [Errno 2] No such file or directory
The problem occurred due to the whitespace in my folder(Which is automatically created by Windows and i couldn't change it)
I tried to change my user name and the folder name is still same and need to download the linter.
I download linter with pip but vscode don't see that. It still asking to install a linter to me.

So you can't just change the name of the folder and call it a day. Changing the username and folder on Windows is a bit more involved and requires you to modify the registry. Here's a quick video that gives instructions. I've done this twice.
https://www.youtube.com/watch?v=w5N2aaiToiQ
At the beginning, when he says you need to create a local user account, you don't need to do that. The user is already created which, for you, appears to be burak kaya.

Related

Cannot save C:\Users\FlapPyBird-master\flappy.py. Unable to create a backup file (flappy.py~). The file left unchanged

I've copied a directory from github and imported it into Pycharm. Now, I wanted to change the code a little bit. But then this error occured:
Cannot save C:\Users\FlapPyBird-master\flappy.py.
Unable to create a backup file (flappy.py~).
The file left unchanged.
Can somebody help me?
Thanks
No, it should not be ever edited.
The behavior is expected, these files must not be edited. this is marked as read-only. If you want to edit files there (you shouldn't, though), you have two options:
change the directory permissions
disable creating a backup
C:\Users\FlapPyBird-master\ is an unusual place to put a git repository. By convention, the subfolders in that location should be the home folders of different users on your system.
If you right-click C:\Users in explorer, and go to Properties->Security, you can see that the folder is likely only editable ("write") by the administrator. Since Pycharm runs in your user's permission, by default it isn't able to edit these locations. (This is part of why your computer will ask you to grant permission when you install software to C:\Program Files, because your user account does not typically have permission to write there)
If you instead place the file in C:\Users\[your username here]\FlapPyBird-master (or better yet, something like C:\Users\[your username here]\Documents\programming_projects\FlapPyBird-master), you'll see that the permissions are already configured to let you edit files there.
If you MUST place the directory in C:\Users, you can right-click->Properties->Security->Edit->Add... and give yourself access this way.

problem on setting up python on visual studio code

After installing Python and Visual Studio code as followed on this link:
https://www.youtube.com/watch?v=dNFgRUD2w68&lc=UgxjG9Bd_Uwm9duwpld4AaABAg
I can't see the reload button in the VS but there are two button; one is disable, and the other is uninstall. Do you know why I don't have reload button and how to resolve this issue?
You don't have to reload the page. Python is already installed.
Just close the current window near the "Extension: Python".
If for some reason VSCode still can't recognize python files, just close it and open it again.
After finishing your Python file in VS Code, save all changes, head to the terminal and enter the directory of the python file(A directory is where you've saved your file), and type python example_file.py.
Of course, you can change the name example_file.py to your actual file name.

File permissions issue with python/Spyder/Anaconda after upgrading mac to Catalina

After upgrading macOS to Catalina, my Anaconda installation was helpfully reconfigured by Apple. Advice from the Anaconda website suggested a fresh install was the best way to go. Did that and all seemed good. I use spyder from the Anaconda navigator. But trying a previously running python code failed due to apparent file permission problems. For example,
file='/Users/stingay/Documents/Coaching/WAIS/2019:20/041019/Race Walk Test-2019-10-04T16.29.13.774-C5612E80FB1D-Accelerometer.csv'
with open(file,'rt') as f:
data = csv.reader(f)
next(data)
results in:
PermissionError: [Errno 1] Operation not permitted: '/Users/stingay/Documents/Coaching/WAIS/2019:20/041019/Race Walk Test-2019-10-04T16.29.13.774-C5612E80FB1D-Accelerometer.csv'
I can't see an issue with the permissions on the file or the directory structure in which the file sits. If I move the file to~/.spyder-py3 (the working directory), it works.
Looks like there is some extra python/spyder/anaconda permissions issue with the file/directory I can't spot. Any ideas?
I guess you have solved this by now, but for future reference, I still post my answer.
TLDR: I opened a file (from the folder causing the problem) directly in
the spyder editor (File | open). As a consequence, the editor should have triggered the pop-up dialog question whether you want to allow access or not. In my case, the mac silently granted python/spyder access to the folder. Now I can run the code in spyder without more problems than I have caused myself.
Longer version:
The source of your problem is described here:
https://www.howtogeek.com/443611/how-macos-catalinas-new-security-features-work/
Knowing that links are something frown upon, here's a summary:
The problem is that the folders "Documents" and "Downloads" folders nowadays are protected and you would need to go to the security & privacy settings and "Files and Folder,s" and allow the applications to access these. Unfortunately, spyder does not show up here. So, if you want to run your python program from the terminal, you should probably grant the terminal access to the folders.
Total noob here, but I might have stumbled upon a solution for people that have problems reading in their data in spyder after the Catalina update. I had the same problems you describe and got the same file permission errors.
I couldn't resolve the issue, reinstalled several times but didn't work for me. I couldn't use my Utorrent either, and while attempting to solve that problem I came across https://discuss.pixls.us/t/problems-with-darktable-and-mac-osx-catalina-solved-with-dt-2-6-3-1/14400/19 this forum.
Long story short, in the forum people couldn't really resolve the issue, but someone pointed out that if you just run the application from the terminal, it somehow works. I tried to do this with Spyder, and I seem to be able to use the read_csv('file') function again. So try opening the terminal, then type 'spyder' (without '') and press enter. Somehow all issues seem to be resolved. Hope this helps someone.
Same problem here. I re-installed Anaconda based on this link and Python is able to access folders where Catalina has added newly restricted security:
Install Anaconda following instructions below:
https://www.anaconda.com/how-to-restore-anaconda-after-macos-catalina-update/
For Anaconda-Jupyter user, you are good to go
For Commandline (Terminal) Python user, you are good to go
For Anaconda-Spyder user, two options as a workaround after installation above:
Avoid Mac default setup-folders and relocate files to /Users/[user_name]/..
OR
Launch Spyder through Terminal (execute "sudo spyder") under root user
Lastly, changing or reseting folder/file permission does not resolve permission issue. Despite of the security issue under the more restricted security folders, somehow Spyder-Python is able to open .py files in these folders.
Since Jupyter and commandline Python can access these folders, I assume there will be a fix in the future for Anaconda-Spyder.
My code didn't work at all after Catalina update. The simplest partial solution that I found was to copy all files containing the scripts in a new folder. That works at least to run the codes, but I still dealing with annoying message to allow access to my files.
conda update --all in terminal worked for me. It updated everything. I did have to go through the annoying messages for access to my files as well. but after clicking yes a hundred times it was ab

python is not recognised as an internal or external command [duplicate]

This question already has answers here:
"python" not recognized as a command
(14 answers)
Closed 2 years ago.
This is a really annoying problem. I've prowled the web for solutions, but all I found was tips about changing the PATH variable, which I did, of course. My Python install directory is C:\Python27. It' a 32 bit version. Whenever I type python in the command prompt, it says that it isn't recognised as an internal or external command. Currently, my PATH variable is set to C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts. Anyone has any ideas? I run Windows 7 by the way (64 bit). I'm pretty desperate. Heck, if nothing works I guess I'll try dual-booting Linux and Windows 7...
Just adding the Python path and trying again worked for me (without reboot).
MS-dos command for Python 2.7:
set PATH=%PATH%;C:\python27\
MS-dos command for Python 3.3:
set PATH=%PATH%;C:\python33\
(check if that is the folder where you installed Python).
Quick fix: May not be the most elegant or long term fix but if you are really frustrated and just want to get it to run, just copy paste the python.exe file to your current directory. This worked for me.
After adding the python folder to the system PATH variable, you should reboot your computer.
Another simple solution is: create a shortcut of the python.exe executable (probably it is in C:\Python27\python.exe, or similar) in a place like C:\Windows\system32 (that is, a place that already is listed in the PATH variable). The name of your shortcut should be python (maybe python.exe should work too). I mean, it can't be python - shortcut or similar, for your purposes.
To see the contents of the PATH variable, go to the cmd and enter set PATH.
After changing the PATH variable in windows, you need to reboot your system before it takes effect.
Edit: As stated by #tdelaney, only a restart of cmd.exe should be required. This is true atleast for Windows 7 64bit.
In your PATH have you got a leading space before your Python path?
For example:
"C:\somedirectory\bin; C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts"
If you have a leading space between path's "ry\bin; C:\Pyt", it won't work and is usually the cause for this type of issue.
When installing, there is a checkbox that is by default not selected, but it asks to add python to the environment variable. Re-install and check that box.
I'd rather the installer do it than struggle in the weeds myself.
Okay, as you said your Python install directory is C:\Python27, open my computer, then open c: drive,
if you don't see "Python27" named folder there then try to search it using search option, (in my case i found it in old.window folder, don't know how it moved there) cut and past it in c drive along with folders like, program files, user etc... , now open cmd and type python and hit enter to check if it is working now,
This is only a partial answer, but I found (repeatedly) that I'd have similar issues when I would use the gui installer and not go through the custom setup.
Using the custom setup option, then using the same settings, the "install for all users" (that then installs to C://python.version/blah instead of the user based default structure) WOULD allow the installer to setup PATH correctly.

Python IDLE won´t start

I´m a noob in python and about a week ago IDLE stop working, I have readed some other people questions about this, but none of them had the same error that I´m getting, which is:
Traceback (most recent call last):
File "c:\python26\Lib\idlelib\idle.py", line 21, in <module>
idlelib.Pyshell.main()
File "C:\python26\Lib\idlelib\PyShll.py", line 1386, in main
root = Tk(className="Idle")
File "C:\python26\Lib\lib-tk\Tkinter.py", line 1643, in __init__
self.tk = _tkinter.creat(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can´t find a usable init.tcl in the following directories:
C:/Python26/lib/tcl8.5 c:/lib/tcl8.5 c:/lib/tcl8.5 c:/library c:/library c:/
tcl8.5.2/library c:/tcl8.5.2/library
This probably means that Tcl wasn´t installed properly.
So I have reinstall python about 3 to 4 times and I keep getting the same error.
I´ll will for ever be in debt to anyone that gives me a solution to this error.
By the way, I´m running Python 2.6.6 on Win 7 32-Bit.
Thank you.
This TCL issue has appeared in a number of Python forums and is generally prevents the IDLE GUI from starting e.g. http://www.gossamer-threads.com/lists/python/python/902912 and is related to the TCL_LIBRARY enviroment variables. Try and edit the enviroment variables
Right click on (My) Computer, go to properties, Advanced Tab, press Environment Variables and edit TCL_LIBRARY to indicate the Python path e.g C:\Python26\tcl\tcl8.5 (or enter the path that represents your version. Idle should start then.
I noticed that this is an issue when you install other programs that may depend on the TCL Library. Happened to me after I installed SciLab. Therefore changing the variable may cause issues with another installed app.
Hope this helps.
Some folders may have been deleted or removed.
Go to Uninstall Program
Choose Python
Click "Change"
Then click "repair"
Allow the computer to repair....Should work after this.
Some notes*
Always make sure everything is in the same directory that you are working in CMD. I opened up my directory from the cmd and put my files in the same directory.
Check your 'App data' folder too for any Python files.
Be aware that 'App data' folder may be hidden.
Also when you reinstall click customize and python will allow you to make your own customize path location which is helpful and a lot more simple then what python chooses.
This could be caused by using the wrong version of Python.
32-bit and 64-bit work differently.
(Assuming your Python install is not corrupt. Did you make any changes to the Python install, try and install anything else?)
What is your Python install directory?
Look under Python_install_directory/tcl , init.tcl should be there, is it?
Tell us what you find.
Hey I don't know why this worked for me but I just right clicked on the the idle icon and clicked "Duplicate". This created another icon "IDLE duplicate", weirdly, and when I try to open this version it works. Hope this helps!

Categories