0

Why is urls.py treated as a .txt file and not as a .py? I tried to remove and re-create the file and even reinstall the program but it doesn't work.

Screen

2 Answers 2

1

I found these steps:

  1. (from OSX): PyCharm → Preferences → IDE Settings → File Types
  2. Select the affected File Type from the list on the top half of this dialog box, Recognized File Types (in my case, Text Files)
  3. Listed in the second half of the dialog box, Registered Patterns were the names of the files that I was having naming/syntax issues with. I clicked on each of those and then clicked on the - for each in turn to remove them from the Registered Patterns list.
  4. Click Apply
  5. Sigh of relief when the syntax highlighting returns and the icon changes back to that of a python file.
Sign up to request clarification or add additional context in comments.

Comments

1

If you are using Windows machine.

Use rename command.

rename filename.py.txt filename.py

And If it is a Linux machine use mv command followed by filename using autocomplete option

$ mv oldfilename filename.py

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.