Python console's workspace path

eryk sun eryksun at gmail.com
Tue Sep 5 14:03:30 EDT 2017


On Tue, Sep 5, 2017 at 9:26 AM, Andrej Viktorovich
<viktorovichandrej at gmail.com> wrote:
>
> I run Python 3.6 console under windows 10. Where is default console directory?

The working directory for the console (i.e. conhost.exe) is irrelevant
to Python. So I assume you mean the default working directory of the
Python shell (i.e. the REPL). There isn't one. It's set by or
inherited from the parent process.

> Can I change default work space location?

For interactive work, set the PYTHONSTARTUP environment variable to
the fully-qualified path of a startup script. Set the working
directory in this script via os.chdir("fully/qualified/path").

For a script, the working directory should not be used to find private
resources. Use the script/package directory for read-only resources
and otherwise use a platform-dependent data directory (e.g. on Windows
use a subdirectory of %LocalAppData% or %ProgramData%).



More information about the Python-list mailing list