osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IDLE Default Working Directory


On Mon, 2018-11-12 at 09:35 -0600, Bev in TX wrote:
> On Nov 12, 2018, at 9:16 AM, eryk sun <eryksun at gmail.com> wrote:
> > On 11/12/18, Christman, Roger Graydon <dvl at psu.edu <mailto:dvl at psu.edu>> wrote:
> > > I looked in IDLE's own configuration menu, and didn't see anything there --
> > > and I fear that I might have to fight some Windows settings somewhere else
> > > instead.   I think this is Windows 10.
> > 
> > Modify the "Start in" field of the IDLE shortcut. You can use
> > environment variables, e.g. "%UserProfile%\Documents".
> 
> I am not the OP and I?m on macOS ? no shortcuts.  How would one do the same thing on other platforms?
> Bev in TX
> 
> 
> 
> 
Hello there,
I am not an IDLE user. You may try a startup script from python, as per the following. 
oney at oney:~$ cat pyhelp/change_to_current_dir.py?#!/usr/bin/env python3
import osimport sys
print("Current directory is:")print(os.path.abspath(os.path.curdir))print("Path to this file is:")print(os.path.abspath(__file__))# Changing current directory to this file's directoryos.chdir(os.path.dirname(os.path.abspath(__file__)))print("Current directory now is:")print(os.path.abspath(os.path.curdir))# sys.path.append(os.path.abspath(__file__))# os.curdir()oney at oney:~$ python3Python 3.5.3 (default, Sep 27 2018, 17:25:39)?[GCC 6.3.0 20170516] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import pyhelp.change_to_current_dirCurrent directory is:/home/oneyDirectory of this file is:/home/oney/pyhelp/change_to_current_dir.pyCurrent directory now is:/home/oney/pyhelp>>>?
HTH