+ 1

When I create (write) a textfile in python (file = open("newfile.txt","w")) - where can I find this file on my device to edit?

After a textfile is written...

17th Jul 2017, 10:08 AM
Conni rado
Conni rado - avatar
4 odpowiedzi
+ 16
@visph oh? 😄thanks for the correction. at least now I know what's right ☺
17th Jul 2017, 11:25 AM
Jobelle
Jobelle - avatar
+ 14
on the same folder where your source code is saved(if you're using pc)
17th Jul 2017, 10:22 AM
Jobelle
Jobelle - avatar
+ 6
@Jobelle wrote: << on the same folder where your source code is saved(if you're using pc) >> Not necessarly at all ^^ Files are saved in the current working directory (folder), which isn't always the script directory :P (at running time if you have modifying it as well as at start) To know what's the current working directory, you can use: import os print(os.getcwd()) And to get the running script directory: import os print(os.path.dirname(os.path.realpath(__file__)))
17th Jul 2017, 11:12 AM
visph
visph - avatar
+ 2
If you're using the SL playground, you'll get ..\Playground\ ..\Playground\ To see the contents, use print(os.listdir()), which will give you [source.py, new file.txt] source.py is the current script you are running. Since newfile.txt is on the SL server not your device, you can't edit it later, and it isn't saved by SL.
18th Jul 2017, 4:53 AM
David Ashton
David Ashton - avatar