Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-29 Thread Christian Tismer
On 29.04.12 07:05, Nick Coghlan wrote: On Sun, Apr 29, 2012 at 1:41 PM, PJ Eby wrote: That's already the case. Actually, sys.path[0] is *always* the absolute path of the script directory -- regardless of whether you invoked the script by a relative path or an absolute one, and regardless of wh

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-29 Thread Christian Tismer
On 28.04.12 21:16, Brett Cannon wrote: On Sat, Apr 28, 2012 at 04:08, Nick Coghlan > wrote: On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon mailto:br...@python.org>> wrote: > I'm personally in favour of changing the insertion of '' to sys.path to > ins

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Nick Coghlan
On Sun, Apr 29, 2012 at 1:41 PM, PJ Eby wrote: > That's already the case.  Actually, sys.path[0] is *always* the absolute > path of the script directory -- regardless of whether you invoked the script > by a relative path or an absolute one, and regardless of whether you're > importing 'site' -- a

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread PJ Eby
On Sat, Apr 28, 2012 at 12:16 PM, R. David Murray wrote: > That said, could this insertion of '' only happen when the interactive > prompt is actually posted, and otherwise use cwd? > That's already the case. Actually, sys.path[0] is *always* the absolute path of the script directory -- regardle

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Steven D'Aprano
Brett Cannon wrote: On Sat, Apr 28, 2012 at 04:08, Nick Coghlan wrote: On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: I'm personally in favour of changing the insertion of '' to sys.path to inserting the cwd when the interpreter is launched. I'm not, because it breaks importing from t

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Terry Reedy
On 4/28/2012 3:16 PM, Brett Cannon wrote: Who does that? I mean what possible need do you have to start the interpreter in one directory, but then need to chdir somewhere else where you are doing your actual importing from, and in a way where you can't simply attach the directory you want to use

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Brett Cannon
On Sat, Apr 28, 2012 at 12:16, R. David Murray wrote: > On Sat, 28 Apr 2012 18:08:08 +1000, Nick Coghlan > wrote: > > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > > > I'm personally in favour of changing the insertion of '' to sys.path to > > > inserting the cwd when the interpreter is

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Brett Cannon
On Sat, Apr 28, 2012 at 09:35, Benjamin Peterson wrote: > 2012/4/28 Nick Coghlan : > > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > >> I'm personally in favour of changing the insertion of '' to sys.path to > >> inserting the cwd when the interpreter is launched. > > > > I'm not, becaus

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Brett Cannon
On Sat, Apr 28, 2012 at 04:08, Nick Coghlan wrote: > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > > I'm personally in favour of changing the insertion of '' to sys.path to > > inserting the cwd when the interpreter is launched. > > I'm not, because it breaks importing from the interact

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread R. David Murray
On Sat, 28 Apr 2012 18:08:08 +1000, Nick Coghlan wrote: > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > > I'm personally in favour of changing the insertion of '' to sys.path to > > inserting the cwd when the interpreter is launched. > > I'm not, because it breaks importing from the int

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Benjamin Peterson
2012/4/28 Nick Coghlan : > On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: >> I'm personally in favour of changing the insertion of '' to sys.path to >> inserting the cwd when the interpreter is launched. > > I'm not, because it breaks importing from the interactive prompt if > you change dir

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-28 Thread Nick Coghlan
On Sat, Apr 28, 2012 at 6:00 AM, Brett Cannon wrote: > I'm personally in favour of changing the insertion of '' to sys.path to > inserting the cwd when the interpreter is launched. I'm not, because it breaks importing from the interactive prompt if you change directory after starting the session.

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-27 Thread Christian Tismer
On 27.04.12 22:00, Brett Cannon wrote: On Fri, Apr 27, 2012 at 10:39, Christian Tismer > wrote: On 27.04.12 02:39, Nick Coghlan wrote: On Fri, Apr 27, 2012 at 7:30 AM, Christian Tismermailto:tis...@stackless.com>> wrote: No big d

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-27 Thread Glenn Linderman
On 4/27/2012 1:00 PM, Brett Cannon wrote: I'm personally in favour of changing the insertion of '' to sys.path to inserting the cwd when the interpreter is launched. +1 ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/li

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-27 Thread Brett Cannon
On Fri, Apr 27, 2012 at 10:39, Christian Tismer wrote: > On 27.04.12 02:39, Nick Coghlan wrote: > >> On Fri, Apr 27, 2012 at 7:30 AM, Christian Tismer >> wrote: >> >>> No big deal and easy to work around, I just would like to understand why. >>> >> I don't like it either and want to change it, bu

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-27 Thread Christian Tismer
On 27.04.12 02:39, Nick Coghlan wrote: On Fri, Apr 27, 2012 at 7:30 AM, Christian Tismer wrote: No big deal and easy to work around, I just would like to understand why. I don't like it either and want to change it, but I'm also not going to mess with it until the importlib bootstrapping is fu

Re: [Python-Dev] package imports, sys.path and os.chdir()

2012-04-26 Thread Nick Coghlan
On Fri, Apr 27, 2012 at 7:30 AM, Christian Tismer wrote: > No big deal and easy to work around, I just would like to understand why. I don't like it either and want to change it, but I'm also not going to mess with it until the importlib bootstrapping is fully integrated and stable. For the mome

[Python-Dev] package imports, sys.path and os.chdir()

2012-04-26 Thread Christian Tismer
Howdy, I have a small problem/observation with imports. I have several packages to import, which works all fine, as long as the packages are imported from directories found on the installed site-packages, via .pth etc. The only problem is the automatically prepended empty string in sys.path. De