Python console's workspace path
On 9/5/2017 10:26 AM, Andrej Viktorovich wrote:
> I run Python 3.6 console under windows 10. Where is default console directory?
It depends on how and where you start it.
> I run script:
>>>> tf = open ("aaa.txt", "w")
>>>> tf.write("aaaa %s" % 123)
> Where file aaa.txt will be created?
I have compiled 3.7 as F:\\dev\\3x\\PCbuild\\win32\\python_d.exe. I
suspect I originally started it from Explorer, so it started in
'F:\\dev\\3x\\PCbuild\\win32'. I then pinned it to the task bar. Left
clicking the icon restarts it in the same directory. If I right click
the icon and then right click 'Python', I see Properties, which shows
"Start in" and a box with the path above. The Start in value can be edited.
If you start python with a console command, instead of an icon, the
initial directory is instead the current directory when you issue the
> Can I change default work space location? How?
By editing the icon (Rustom Mody), changing the directory before issuing
a startup command, or with os.chdir (MRAB).
Terry Jan Reedy