1

I tried to right click the file and rename it, but it won't even show me the extension so that I could delete it. I also tried going to properties and I couldn't do it from there either. I didn't code directly with the Tkinter of python, I used a custom made graphics library that came with my book.

dsh
  • 12,037
  • 3
  • 33
  • 51
Ovi
  • 573
  • 2
  • 5
  • 16
  • 2
    drop to a shell and rename there, or change Windoze Exploder to **NOT** hide file extensions. – Marc B Jul 28 '15 at 17:12

1 Answers1

7

You are on the right lines in that you just need to rename it - unfortunately modern versions of Windows hide the extension by default so you can't readily modify it.

I tend to set Windows to always display extensions (as this fixes this issue computer-wide), but if this is undesirable or not possible you can always use the command prompt:

cd C:\Path\To\File
ren MyPythonScript.py MyPythonScript.pyw

Hope this helps.

Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
SteJ
  • 1,491
  • 11
  • 13
  • Thanks it worked. I thought .pyw wasnt going to open the shell anymore tho but it still does? – Ovi Jul 28 '15 at 17:28
  • Do you mean the console window still pops up in addition to your own window? It could be that you are writing to the console (ie. calling print()) within your script) and this is keeping the console window open? – SteJ Jul 28 '15 at 17:34
  • No, I don't have print anywhere in my program. The shell just opens up and there is just blank. – Ovi Jul 28 '15 at 20:57
  • Could it be a module you're using is keeping the console open (see accepted response [here](http://stackoverflow.com/questions/1765078/how-to-avoid-console-window-with-pyw-file-containing-os-system-call))? - I don't know of any other reason a pyw file would have a console window. – SteJ Jul 28 '15 at 21:20
  • For me it depended on what is associated with the pyw extension - python.exe opens console, pythonw.exe does not (under normal circumstances). – Andris Jul 12 '19 at 12:41
  • "unfortunately modern versions of Windows hide the extension so you can't readily modify it": well, as you said you have to change file explorer preferences to show extensions. The only sane way to use windows – Jean-François Fabre Apr 28 '21 at 07:13