[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset df12c29882b1 by Steve Dower in branch '3.5':
Issue #25450: Updates shortcuts to start Python in installation directory.
https://hg.python.org/cpython/rev/df12c29882b1

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-31 Thread Steve Dower

Steve Dower added the comment:

I've fixed the shortcuts. Let me know if you add any extra command line options 
to Idle for setting a more useful start directory and I can add those to the 
shortcuts as well.

--
resolution:  -> fixed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-31 Thread Steve Dower

Changes by Steve Dower :


--
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-31 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Steve, I am adding you as nosy on #22121, which is now about adding a new 
startup option.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-25 Thread Steve Dower

Steve Dower added the comment:

We can add more options to the start menu icon, even something like "--start-in 
%userprofile%" should work there, as it really is just a blob of text (though I 
need to test that). Accepting "--start-in ~" and os.path.expanduser() would 
also be fine, I believe.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-25 Thread eryksun

eryksun added the comment:

Steve, I think you're right that it's simpler and more reliable to add a 
command-line option that sets IDLE's working directory to the current user's 
home directory. 

Terry, the default behavior in Linux, at least in Ubuntu, is to start IDLE with 
the working directory set to the user's home directory. 

The Linux equivalent of a Windows .lnk shortcut is an XDG .desktop file [1]. A 
desktop application entry sets the working directory using the "Path" key, such 
as Path=/absolute/path (or also, and maybe only in Ubuntu Unity, 
Path=relative/path) in the main "Desktop Entry" or in a "Desktop Action" (i.e. 
right-click menu action). Environment variables are not supported. 

If "Path" isn't defined, I can only say from experience what Ubuntu's Unity 
shell does, since the spec doesn't define a default behavior. In this case, the 
child process inherits Unity's working directory. Since it's a plugin for the 
Compiz window manager, the child inherits the working directory of Compiz. This 
is the current user's $HOME directory, which Compiz inherits indirectly from 
the user-mode init process. I confirmed the behavior by attaching gdb to compiz 
and executing `call chdir("/home")`, and then continued compiz and opened IDLE 
to verify that the working directory was inherited as "/home". 

[1]: http://standards.freedesktop.org/desktop-entry-spec/latest

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-25 Thread Steve Dower

Steve Dower added the comment:

Unfortunately it looks like MSI won't let you put an environment variable into 
the shortcut, as it has to resolve it on install (see WkDir at 
https://msdn.microsoft.com/en-us/library/aa371847(VS.85).aspx)

Trying some other ideas, but it looks like the most robust solution will be for 
IDLE to change the current directory on startup (maybe via a command line 
option?), or specify the initial directory in its open/save dialogs.

Otherwise, the best I can realistically promise is to set it to the Python 
install directory, which is not particularly useful either...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I see the problem: there is only one IDLE icon for all users, so you need the 
env var to customize for each user, which you cannot use. Staying with the 
python install directory, as before, should be better.  We never got any 
complaints about that.  But the new install locations are more problematical.

I have also thought of adding an new startup option, but it should only apply 
if IDLE is started with the ICON.  When started at the command line, it should 
start at the current directory of the console, as it does now, so '.' refers to 
that directory.  Ironically, a current directory of .../system32 would be a 
good indicator.  I need to see what is in sys.argv after the different start 
methods.

This issue is currently only for Windows. I don't know what happens on other 
systems or whether they could stand improvement.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-21 Thread Steve Dower

Changes by Steve Dower :


--
assignee:  -> steve.dower

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-21 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
title: IDLE: Save path automatically choses C:\Windows\system32 -> Python 3.5 
starts in C:\Windows\system32 as current directory
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-21 Thread eryksun

eryksun added the comment:

> 'Start in:' is blank and for what ever reason, the default is ...system32. 

When the "Start in" field of a .lnk shortcut is blank, the child process 
inherits the working directory of the parent process (i.e. the process that 
runs the shortcut), unless the parent passes some other directory to 
ShellExecute. 

If you copy the shortcut to the desktop, for example, Explorer sets the working 
directory to the desktop. If it's run from the command prompt, cmd uses its own 
working directory. When run from the Start menu, the child inherits Explorer's 
working directory, %SystemRoot%\System32.

The old installer (pre-3.5) sets "Start in" to the installation directory. IMO, 
a better choice would be "%USERPROFILE%". The Windows shell expands the 
environment variable to the current user's profile directory when it runs the 
shortcut. 

I'm not keen on using a profile subdirectory such as "Documents" or "Desktop", 
since a user can relocate most of the special folders in his or her profile. 
Unfortunately the "Start in" field won't accept shell: locations such as 
"shell:Personal" or "shell:Desktop". It would be nice if it did, since those 
take into account relocated folders.

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25450] Python 3.5 starts in C:\Windows\system32 as current directory

2015-10-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Thanks for the explanation.  When I did the test with Command Prompt, I 
happened to be in /Users/Terry, which is where C.P. starts.  %USERPROFILE% is 
what I was thinking of but could not precisely remember.  It worked when put in 
that box.

I think adding /Documents would be a mistake because many users (including me) 
put Python stuff in other subdirectories.

A minor mystery.  Changing Start in: for the Python icon requires admin 
permission; for the IDLE icon, not.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com