I use

$ sudo nano first.py


$ nano first.py

to start a new nano file (in Python), while using Bash on Windows 10, but the file won't save.

The error I get when I try to save the file is:

[ Error while writing first.py: Access denied ]

Any ideas? I cannot find answers anywhere on the Internet.

  • 1
    (1) As a matter of nomenclature, you’re not starting a new nano file in Python, you’re creating a new Python file in nano.  (2) More importantly, what directory are you in when you do this?  Does a first.py file already exist?  What happens if you type > first.py? Please do not respond in comments; edit your question to make it clearer and more complete. – Scott Sep 24 '17 at 12:19

There might be an issue with the Ubuntu installation in Windows. I had similar issues and a reinstall helped. Try reinstalling Ubuntu on Windows

To reinstall:

Run PowerShell as Administrator and then

lxrun /uninstall

Press "y". And then reinstall with

lxrun /install

Press "y". It takes about 10 min to reinstall. Hope that helps.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.