[Tutor] Python File Moving
Alan Gauld
alan.gauld at yahoo.co.uk
Sun Aug 21 08:16:20 EDT 2022
On 21/08/2022 00:50, Kieran W wrote:
> So I tried moving my python files into a place where I could see them
> because they were in the appdata folder (I have windows 11). I usually
> open files directly from the python app I have and the background in white
> with all the file, edit, run, etc. options.
That sounds like you mean IDLE? How do you launch IDLE?
>From a menu? Double clicking the python file?
> But once I moved it, it would open in a black background and I wouldn’t be
> able to code.
That sounds like the command-line interpreter. Again how are you
launching it?
It sounds to me as if you are double clicking the files in explorer?
If so then the file associations may be messed up by your
moving the files. In that case you need to go in and manually
change the file association to run IDLE instead of python.exe
(or py.exe).
However, using IDLE to execute your programs once you have finished
editing is not the best approach. It's better to run Python code
via the interpreter (ie python.exe or py.exe) and only edit it
(and debug etc) in IDLE (or any other IDE).
You might want to set up the file asociations so you can right-click
the file and "Edit" via IDLE and "Run" via py.exe.
> It is freaking me out because I just lost a 150 line code
> program I JUST WROTE.
Where did you save it? the program will be in a file so
if you know the name of it you can find it with the
windows search tool.
It's best practice to store all your source files in a separate
folder from your Python installation. That way if you upgrade
Python (or move it, as you did!) the source files are still
where you left them.
> NOW. Please help, I really don’t want to lose my program…
Assuming you saved the code as a file ending in .py (as is
normally done) you should be able to find it again.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list