Re: PythonPath / sys.path

2023-05-15 Thread Thomas Passin
On 5/15/2023 3:26 AM, Barry wrote: On 15 May 2023, at 05:39, Thomas Passin wrote: On 5/14/2023 11:08 PM, Chris Angelico wrote: On Mon, 15 May 2023 at 12:07, Thomas Passin wrote: Well, no, why would you assume that? I started to use Linux - in VMs - because I had to make sure that my cros

Re: PythonPath / sys.path

2023-05-15 Thread Chris Angelico
On Mon, 15 May 2023 at 14:38, Thomas Passin wrote: > > On 5/14/2023 11:08 PM, Chris Angelico wrote: > > On Mon, 15 May 2023 at 12:07, Thomas Passin wrote: > >> Well, no, why would you assume that? I started to use Linux - in VMs - > >> because I had to make sure that my cross-platform java/jytho

Re: PythonPath / sys.path

2023-05-15 Thread Barry
> On 15 May 2023, at 05:39, Thomas Passin wrote: > > On 5/14/2023 11:08 PM, Chris Angelico wrote: >>> On Mon, 15 May 2023 at 12:07, Thomas Passin wrote: >>> Well, no, why would you assume that? I started to use Linux - in VMs - >>> because I had to make sure that my cross-platform java/jytho

Re: PythonPath / sys.path

2023-05-14 Thread Thomas Passin
On 5/14/2023 11:08 PM, Chris Angelico wrote: On Mon, 15 May 2023 at 12:07, Thomas Passin wrote: Well, no, why would you assume that? I started to use Linux - in VMs - because I had to make sure that my cross-platform java/jython Tomcat program would work right on Linux. Why, for example, woul

Re: PythonPath / sys.path

2023-05-14 Thread Chris Angelico
On Mon, 15 May 2023 at 12:07, Thomas Passin wrote: > Well, no, why would you assume that? I started to use Linux - in VMs - > because I had to make sure that my cross-platform java/jython Tomcat > program would work right on Linux. Why, for example, would I think to > install Idle from the packa

Re: PythonPath / sys.path

2023-05-14 Thread Thomas Passin
On 5/14/2023 7:28 PM, Chris Angelico wrote: On Mon, 15 May 2023 at 09:22, Thomas Passin wrote: You made a little slam against Windows, but you will find it harder to get things working on Linux. Ubuntu, like many other Linux distros, does not come with pip and Tk (needed for Idle) installed, a

Re: PythonPath / sys.path

2023-05-14 Thread Chris Angelico
On Mon, 15 May 2023 at 09:22, Thomas Passin wrote: > You made a little slam against Windows, but you will find it harder to > get things working on Linux. Ubuntu, like many other Linux distros, > does not come with pip and Tk (needed for Idle) installed, and it's not > so obvious how to install t

Re: PythonPath / sys.path

2023-05-14 Thread Thomas Passin
On 5/14/2023 3:00 PM, Grizzy Adams via Python-list wrote: Sunday, May 14, 2023 at 11:11, Mats Wichmann wrote: Re: PythonPath / sys.path (at least in part) [snip] I have since moved up (a little) so only ~4 years old, I then updated pip from 9.x to 19.1 reason its an old version is it'

Re: PythonPath / sys.path

2023-05-14 Thread Eryk Sun
not help, The default value of the above registry key is only used if Python can't calculate the default sys.path based on searching for "os.py", the landmark module in the standard library. This can happen sometimes when Python is embedded or run from a symlink. The default value

Re: PythonPath / sys.path

2023-05-14 Thread Mats Wichmann
On 5/14/23 13:00, Grizzy Adams via Python-list wrote: Sunday, May 14, 2023 at 11:11, Mats Wichmann wrote: Re: PythonPath / sys.path (at least in part) On 5/14/23 10:43, Barry wrote: I take it you have business reasons to use an obsolete version python. Where did you get your version of

Re: PythonPath / sys.path

2023-05-14 Thread Grizzy Adams via Python-list
Sunday, May 14, 2023 at 11:11, Mats Wichmann wrote: Re: PythonPath / sys.path (at least in part) >On 5/14/23 10:43, Barry wrote: >> I take it you have business reasons to use an obsolete version python. >> Where did you get your version of python from? >In fact, a *nine* y

Re: PythonPath / sys.path

2023-05-14 Thread Mats Wichmann
nything to do with the sys.path, though. -- https://mail.python.org/mailman/listinfo/python-list

Re: PythonPath / sys.path

2023-05-14 Thread Barry
> On 14 May 2023, at 16:32, Grizzy Adams via Python-list > wrote: > > Hi All > > My first post (repeated) > > I am having a problem with PythonPath / sys.path > > I have a dir where I keep all my current work, but I can't seem to add it to > Py

PythonPath / sys.path

2023-05-14 Thread Grizzy Adams via Python-list
Hi All My first post (repeated) I am having a problem with PythonPath / sys.path I have a dir where I keep all my current work, but I can't seem to add it to PythonPath / sys.path When I try to import one of my modules I see >>>import My_Working_File Traceback (most recent call

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-24 Thread jak
Ralf M. ha scritto: Am 22.04.2023 um 03:27 schrieb Greg Ewing via Python-list: How are you invoking your script? Presumably you have some code in your embedding application that takes a script path and runs it. Instead of putting the code to update sys.path into every script, the embedding

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-23 Thread Mats Wichmann
On 4/22/23 16:04, Ralf M. wrote: Am 21.04.2023 um 18:07 schrieb Thomas Passin: On 4/20/2023 5:47 PM, Ralf M. wrote: Hello, when I run a script with a "normally" installed python, the directory the script resides in is automatically added as first element to sys.path, so th

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-22 Thread Greg Ewing via Python-list
On 23/04/23 10:04 am, Ralf M. wrote: I thought about that, but for that to work all local modules across all script locations must have unique names, otherwise import might get hold of a module from the wrong directory. You could put all the local modules belonging to a particular script into

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-22 Thread Thomas Passin
On 4/22/2023 5:45 PM, Ralf M. wrote: Am 22.04.2023 um 03:27 schrieb Greg Ewing via Python-list: How are you invoking your script? Presumably you have some code in your embedding application that takes a script path and runs it. Instead of putting the code to update sys.path into every script

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-22 Thread Ralf M.
Am 21.04.2023 um 18:07 schrieb Thomas Passin: On 4/20/2023 5:47 PM, Ralf M. wrote: Hello, when I run a script with a "normally" installed python, the directory the script resides in is automatically added as first element to sys.path, so that "import my_local_module" find

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-22 Thread Ralf M.
Am 22.04.2023 um 03:27 schrieb Greg Ewing via Python-list: How are you invoking your script? Presumably you have some code in your embedding application that takes a script path and runs it. Instead of putting the code to update sys.path into every script, the embedding application could do it

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-22 Thread Ralf M.
Am 21.04.2023 um 17:31 schrieb Mats Wichmann: On 4/20/23 15:47, Ralf M. wrote: Hello, when I run a script with a "normally" installed python, the directory the script resides in is automatically added as first element to sys.path, so that "import my_local_module" finds m

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-21 Thread Greg Ewing via Python-list
How are you invoking your script? Presumably you have some code in your embedding application that takes a script path and runs it. Instead of putting the code to update sys.path into every script, the embedding application could do it before running the script. -- Greg -- https

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-21 Thread Thomas Passin
On 4/20/2023 5:47 PM, Ralf M. wrote: Hello, when I run a script with a "normally" installed python, the directory the script resides in is automatically added as first element to sys.path, so that "import my_local_module" finds my_local_module.py in the directory of t

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-21 Thread Mats Wichmann
On 4/20/23 15:47, Ralf M. wrote: Hello, when I run a script with a "normally" installed python, the directory the script resides in is automatically added as first element to sys.path, so that "import my_local_module" finds my_local_module.py in the directory of the scrip

Incomplete sys.path with embeddable python (Windows)!?

2023-04-21 Thread Ralf M.
Hello, when I run a script with a "normally" installed python, the directory the script resides in is automatically added as first element to sys.path, so that "import my_local_module" finds my_local_module.py in the directory of the script. However, when I run

Re: link to venv python sees a different sys.path

2020-03-12 Thread Dieter Maurer
Robin Becker wrote at 2020-3-12 10:25 +: > ... >I want many different versions of python all in one place to use for testing. I contribute to the `zopefoundation` projects. They, too, have a need to test with many different Python versions -- and use "tox" for it. Maybe, "tox" can also help so

Re: link to venv python sees a different sys.path

2020-03-12 Thread Robin Becker
On 12/03/2020 09:19, Dieter Maurer wrote: Let me try again: When you start "python", its "site" module extends "sys.path" to include an appropriate "site-packages". For this, it uses a heuristic based on the path with which you have called the i

Re: link to venv python sees a different sys.path

2020-03-12 Thread Dieter Maurer
s just a link to the base python. > >It seems as though the above doesn't apply to the python itself which seems >kind of dumb. A quick check reveals that the >documentation later which says Let me try again: When you start "python", its "site" module extends &q

Re: link to venv python sees a different sys.path

2020-03-12 Thread Robin Becker
On 11/03/2020 17:24, Dieter Maurer wrote: Robin Becker wrote at 2020-3-11 15:26 +: I'm trying to understand why python 3.8.2 venv behaves differently when it is executed va a link Make the env rptlab@everest:~/code/hg-repos $ python38 -mvenv __py__/382v ... so the linked versio

Re: link to venv python sees a different sys.path

2020-03-11 Thread Dieter Maurer
> >make a link >> $ ln -s ../__py__/382v/bin/python bin/python382v > >the venv sys.path >> rptlab@everest:~/code/hg-repos > $ __py__/382v/bin/python -c"import >> sys;print('\n'.join(sys.path))" >> >> /home/rptlab/LOCAL/382/lib/pyth

Re: link to venv python sees a different sys.path

2020-03-11 Thread Jon Ribbens via Python-list
On 2020-03-11, Robin Becker wrote: > I'm trying to understand why python 3.8.2 venv behaves differently > when it is executed va a link Because site.py contains a function called venv() which looks up the path of the executed python binary, and searches for the virtual environment relative to tha

link to venv python sees a different sys.path

2020-03-11 Thread Robin Becker
I'm trying to understand why python 3.8.2 venv behaves differently when it is executed va a link Make the env rptlab@everest:~/code/hg-repos $ python38 -mvenv __py__/382v rptlab@everest:~/code/hg-repos make a link $ ln -s ../__py__/382v/bin/python bin/python382v the venv sys.path r

Re: `import somemodule` does not check all paths in `sys.path`

2018-07-30 Thread stefand986
Note that in the `sys.path`variable the path is given as absolute path (I only wrote it relative to `~` in the in my post, but in the script the absolute path is used everywhere). See line 2: ``` ['/home/pyuser/.homeassistant', '/home/pyuser/.homeassistant/deps/lib

Re: `import somemodule` does not check all paths in `sys.path`

2018-07-29 Thread Chris Angelico
ad than where the modules are imported. (However >> as far as I can tell the importing thread waits for the install to finish.) >> >> Now the interesting thing is that when I start HA in verbose mode, I can see >> that Python is trying not all of the paths that are in `sys.

Re: `import somemodule` does not check all paths in `sys.path`

2018-07-29 Thread dieter
g thread waits for the install to finish.) > > Now the interesting thing is that when I start HA in verbose mode, I can see > that Python is trying not all of the paths that are in `sys.path` (in the > following snippet I cut out some stuff for brevity. Link to the full log at > the

Re: `import somemodule` does not check all paths in `sys.path`

2018-07-29 Thread stefand986
Am Sonntag, 29. Juli 2018 01:32:07 UTC+2 schrieb MRAB: That was also my first suspicion, but I checked that the path exists by printing the directory contents out, right before the ìmport ` statement. The "please check your config" message are a result of another package (aiohttp_cors) that is a

Re: `import somemodule` does not check all paths in `sys.path`

2018-07-28 Thread MRAB
start HA in verbose mode, I can see that Python is trying not all of the paths that are in `sys.path` (in the following snippet I cut out some stuff for brevity. Link to the full log at the end). As one can see the `~/.homeassistant/deps/lib/python3.7/site-packages` location is not tried and he

`import somemodule` does not check all paths in `sys.path`

2018-07-28 Thread stefand986
is trying not all of the paths that are in `sys.path` (in the following snippet I cut out some stuff for brevity. Link to the full log at the end). As one can see the `~/.homeassistant/deps/lib/python3.7/site-packages` location is not tried and hence the import fails: ``` # trying /home/p

Re: sys.path[] question

2017-10-29 Thread ElChino
Thomas Jollans wrote: You can find out where a module is loaded from by checking its __file__ attribute. Run python (in interactive mode) and execute import pyreadline pyreadline.__file__ Thanks for that tip. Does that mean that only this .egg is where python imports all pyreadline files f

Re: sys.path[] question

2017-10-29 Thread Thomas Jollans
On 28/10/17 19:24, ElChino wrote: > From the Python2.7 snippet in [1], Python2.7 reports that my > sys.path[] contains: > f:\ProgramFiler\Python27\lib\site-packages\pyreadline-2.0-py2.7-win32.egg > > (a .zip-file) > > But I have also a 'f:\ProgramFiler\Python27\li

sys.path[] question

2017-10-28 Thread ElChino
From the Python2.7 snippet in [1], Python2.7 reports that my sys.path[] contains: f:\ProgramFiler\Python27\lib\site-packages\pyreadline-2.0-py2.7-win32.egg (a .zip-file) But I have also a 'f:\ProgramFiler\Python27\lib\site-packages\pyreadline' directory. With the complete package A

Re: Not appending ("lib") to sys.path breaks tests.

2017-09-08 Thread Ian Kelly
;s failing to find the lib package. Since you removed >> the "lib" directory from sys.path, does its parent directory exist in >> sys.path? > > > The path is not in the modules path or in sys.path. Hence the append. I > thought I could add the local "lib"

Re: Not appending ("lib") to sys.path breaks tests.

2017-09-08 Thread Leam Hall
On 09/08/2017 05:41 PM, Ian Kelly wrote: I'm confused about where the character_tools import is made. If that's within a module in the lib package, it should be fine. It looks like it's failing to find the lib package. Since you removed the "lib" directory from

Re: Not appending ("lib") to sys.path breaks tests.

2017-09-08 Thread Ian Kelly
ERROR collecting tests/test_base_tools.py > __ > tests/test_base_tools.py:6: in >> import lib.base_tools > E ImportError: No module named lib.base_tools It looks like it's failing to find the lib package. Since you removed th

Not appending ("lib") to sys.path breaks tests.

2017-09-08 Thread Leam Hall
A kind soul pointed out that my code uses a sys.path.append("lib") to get files to be imported: sys.path.append("lib") from character_tools import * He noted that having an __init__.py in lib and using: from .character_tools import * Should be sufficient for "please do

Re: best way to ensure './' is at beginning of sys.path?

2017-02-07 Thread Chris Angelico
On Wed, Feb 8, 2017 at 8:22 AM, Pavol Lisy wrote: >>> How about graphic and video designers? Just how well does hg cope with >>> gigabytes of video data? >> >> I've no idea, but I know that git can handle large amounts of data. >> (There are a couple of extensions that make it easier.) > > But the

Re: best way to ensure './' is at beginning of sys.path?

2017-02-07 Thread Pavol Lisy
On 2/6/17, Chris Angelico wrote: > On Mon, Feb 6, 2017 at 1:19 PM, Steve D'Aprano > wrote: [...] >> How about graphic and video designers? Just how well does hg cope with >> gigabytes of video data? > > I've no idea, but I know that git can handle large amounts of data. > (There are a couple of

Re: best way to ensure './' is at beginning of sys.path?

2017-02-05 Thread Wildman via Python-list
On Mon, 06 Feb 2017 09:07:34 +1100, Steve D'Aprano wrote: > On Sun, 5 Feb 2017 07:01 pm, Wildman wrote: > >> Sure, you >> could trick someone into running a program that could >> mess with $HOME but that is all.  For anyone, like me, >> that makes regular backups, that is not a big problem. >> To

Re: best way to ensure './' is at beginning of sys.path?

2017-02-05 Thread Chris Angelico
On Mon, Feb 6, 2017 at 1:19 PM, Steve D'Aprano wrote: > On Mon, 6 Feb 2017 09:26 am, Chris Angelico wrote: > >> On Mon, Feb 6, 2017 at 9:07 AM, Steve D'Aprano >> wrote: >>> As far as "regular backups", well, you're just not thinking deviously >>> enough. If I were to write a ransomware applicatio

Re: best way to ensure './' is at beginning of sys.path?

2017-02-05 Thread Steve D'Aprano
On Mon, 6 Feb 2017 09:26 am, Chris Angelico wrote: > On Mon, Feb 6, 2017 at 9:07 AM, Steve D'Aprano > wrote: >> As far as "regular backups", well, you're just not thinking deviously >> enough. If I were to write a ransomware application, running as the >> regular user, I would have the applicatio

Re: best way to ensure './' is at beginning of sys.path?

2017-02-05 Thread Chris Angelico
On Mon, Feb 6, 2017 at 9:07 AM, Steve D'Aprano wrote: > As far as "regular backups", well, you're just not thinking deviously > enough. If I were to write a ransomware application, running as the regular > user, I would have the application encrypt files and emails just a few at a > time, over a p

Re: best way to ensure './' is at beginning of sys.path?

2017-02-05 Thread Steve D'Aprano
On Sun, 5 Feb 2017 07:01 pm, Wildman wrote: > Sure, you > could trick someone into running a program that could > mess with $HOME but that is all.  For anyone, like me, > that makes regular backups, that is not a big problem. > To do any real damage to the system or install a key > logger or some

Re: best way to ensure './' is at beginning of sys.path?

2017-02-05 Thread Wildman via Python-list
On Sat, 04 Feb 2017 19:12:55 +, Grant Edwards wrote: > On 2017-02-04, Wildman via Python-list wrote: >>> >>> The next time you are in the /tmp directory looking for something, can >>> you guess what happens when you mistype "ls" as "sl"? >>> DOS and Windows has searched the current dir

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread eryk sun
On Sat, Feb 4, 2017 at 3:19 PM, Wildman via Python-list wrote: > > Personally I don't understand the danger in having the dot in the path. The > './' only > means the current directory. DOS and Windows has searched the current > directory > since their beginning. Is that also dangerous? On W

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Michael Torrie
On 02/04/2017 12:20 PM, Lew Pitcher wrote: > It doesn't take root access to write a file to /tmp > In fact, /tmp is specifically set up to allow /any/ user to create /any/ file > or directory in it. > > Witness: > > > guest@bitsie:~$ chmod a+x /tmp/dothis > > Hey! I've even made the file exe

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Michael Torrie
On 02/04/2017 08:19 AM, Wildman via Python-list wrote: > No, I do not know. You might try your question in > a linux specific group. Personally I don't understand > the danger in having the dot in the path. The './' > only means the current directory. DOS and Windows > has searched the current

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Cameron Simpson
On 04Feb2017 12:56, Wildman wrote: On Sat, 04 Feb 2017 18:25:03 +, Grant Edwards wrote: The next time you are in the /tmp directory looking for something, can you guess what happens when you mistype "ls" as "sl"? [...] Your scenario assumes the malicious user has root access to be able to

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Cameron Simpson
On 04Feb2017 09:19, Wildman wrote: [...] Personally I don't understand the danger in having the dot in the path. The './' only means the current directory. DOS and Windows has searched the current directory since their beginning. Is that also dangerous? Citing DOS and Windows as prior art

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Cameron Simpson
On 04Feb2017 08:10, Neal Becker wrote: Neal Becker wrote: I want to make sure any modules I build in the current directory overide any others. To do this, I'd like sys.path to always have './' at the beginning. What's the best way to ensure this is always true wh

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Marko Rauhamaa
Dan Sommers : > On Sat, 04 Feb 2017 21:19:06 +0200, Marko Rauhamaa wrote: >> Now, that's why the distros are careful to place $HOME/bin as the >> final entry of PATH; the system commands take precedence over the >> user's personal ones. However, the user is free to define the PATH >> any way they

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Dan Sommers
On Sat, 04 Feb 2017 21:19:06 +0200, Marko Rauhamaa wrote: > Now, that's why the distros are careful to place $HOME/bin as the > final entry of PATH; the system commands take precedence over the > user's personal ones. However, the user is free to define the PATH any > way they like. I deliberatel

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Lew Pitcher
On Saturday February 4 2017 13:56, in comp.lang.python, "Wildman" wrote: > On Sat, 04 Feb 2017 18:25:03 +, Grant Edwards wrote: > >> On 2017-02-04, Wildman via Python-list wrote: >> >>> No, I do not know. You might try your question in a linux specific >>> group. Personally I don't unde

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Marko Rauhamaa
Grant Edwards : > It allows a malicous user to put an evil executable someplace public > like /tmp and have it executed accidentally. For example, let's say > this executable file was named "sl" and placed in /tmp. > > --sl-- > #!/bin/bash >

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Dan Sommers
On Sat, 04 Feb 2017 12:56:58 -0600, Wildman wrote: > On Sat, 04 Feb 2017 18:25:03 +, Grant Edwards wrote: >> It allows a malicous user to put an evil executable someplace public >> like /tmp and have it executed accidentally. For example, let's say >> this executable file was named "sl" and

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Grant Edwards
On 2017-02-04, Wildman via Python-list wrote: >> >> The next time you are in the /tmp directory looking for something, can >> you guess what happens when you mistype "ls" as "sl"? >> >>> DOS and Windows has searched the current directory since their >>> beginning. Is that also dangerous? >> >>

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Wildman via Python-list
On Sat, 04 Feb 2017 18:25:03 +, Grant Edwards wrote: > On 2017-02-04, Wildman via Python-list wrote: > >> No, I do not know. You might try your question in a linux specific >> group. Personally I don't understand the danger in having the dot >> in the path. The './' only means the current

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Grant Edwards
On 2017-02-04, Wildman via Python-list wrote: > No, I do not know. You might try your question in a linux specific > group. Personally I don't understand the danger in having the dot > in the path. The './' only means the current directory. It allows a malicous user to put an evil executable

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread alister
On Sat, 04 Feb 2017 09:19:38 -0600, Wildman wrote: > On Sat, 04 Feb 2017 11:27:01 +0200, Jussi Piitulainen wrote: > >> Wildman writes: >> >> [snip] >> >>> If anyone is interested the correct way is to add this to /etc/profile >>> (at the bottom): >>> >>> PATH=$PATH:./ >>> export PATH >> >> Out

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Jussi Piitulainen
Wildman writes: > On Sat, 04 Feb 2017 11:27:01 +0200, Jussi Piitulainen wrote: > >> Wildman writes: >> >> [snip] >> >>> If anyone is interested the correct way is to add this to >>> /etc/profile (at the bottom): >>> >>> PATH=$PATH:./ >>> export PATH >> >> Out of interest, can you think of a cor

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Wildman via Python-list
On Sat, 04 Feb 2017 11:27:01 +0200, Jussi Piitulainen wrote: > Wildman writes: > > [snip] > >> If anyone is interested the correct way is to add this to >> /etc/profile (at the bottom): >> >> PATH=$PATH:./ >> export PATH > > Out of interest, can you think of a corresponding way that a mere user

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Neal Becker
Neal Becker wrote: > I want to make sure any modules I build in the current directory overide > any > others. To do this, I'd like sys.path to always have './' at the > beginning. > > What's the best way to ensure this is always true whenever I run python

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Jussi Piitulainen
Wildman writes: [snip] > If anyone is interested the correct way is to add this to > /etc/profile (at the bottom): > > PATH=$PATH:./ > export PATH Out of interest, can you think of a corresponding way that a mere user can remove the dot from their $PATH after some presumably well-meaning system

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Michael Felt
ir trojan horse commands after typing errors, such as the ever popular "gerp" search programme. Even with Python I'd feel it is better to not have "." in the sys.path; I'd be happier with a full path to a preferred source of modules. (Yes, I know Python likes to search

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Ben Finney
Steve D'Aprano writes: > On Sat, 4 Feb 2017 10:13 am, Ben Finney wrote: > > See https://www.python.org/dev/peps/pep-0328/>, in particular > > https://www.python.org/dev/peps/pep-0328/#guido-s-decision>. > > I think you are conflating the package directory and . the current > working directory. I

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Cameron Simpson
On 04Feb2017 13:59, Steve D'Aprano wrote: On Sat, 4 Feb 2017 01:13 pm, Cameron Simpson wrote: 1. In your .bashrc file, or equivalent, set the environment variable PYTHONPATH: export PYTHONPATH='./;$PYTHONPATH' You want double quotes (allowing parameter substitution) instead of single quote

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Steve D'Aprano
On Sat, 4 Feb 2017 10:13 am, Ben Finney wrote: > So, for the past ten years and more, Python supports import of modules > from the current directory with an explicit *relative* path:: > > # Absolute imports, searching ‘sys.path’. > import datetime > from collections

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Steve D'Aprano
On Sat, 4 Feb 2017 01:13 pm, Cameron Simpson wrote: >>1. In your .bashrc file, or equivalent, set the environment >> variable PYTHONPATH: >>export PYTHONPATH='./;$PYTHONPATH' > > You want double quotes (allowing parameter substitution) instead of single > quotes here. Or, of course, no quotes a

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Cameron Simpson
s. To do this, I'd like sys.path to always have './' at the beginning. The ‘sys.path’ list is used only for *absolute* imports. Modules in the current directory should not be imported with an absolute path[0]. So, the current directory should not be in ‘sys.path’. [...] [0]: Why no

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Cameron Simpson
On 04Feb2017 12:16, Steve D'Aprano wrote: On Sat, 4 Feb 2017 03:06 am, Neal Becker wrote: I want to make sure any modules I build in the current directory overide any others. To do this, I'd like sys.path to always have './' at the beginning. What's the best way to e

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Steve D'Aprano
On Sat, 4 Feb 2017 10:13 am, Ben Finney wrote: > Neal Becker writes: > >> I want to make sure any modules I build in the current directory >> overide any others. To do this, I'd like sys.path to always have './' >> at the beginning. > > The ‘sys.p

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Cameron Simpson
such as the ever popular "gerp" search programme. Even with Python I'd feel it is better to not have "." in the sys.path; I'd be happier with a full path to a preferred source of modules. (Yes, I know Python likes to search the current directory for modules, n

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Steve D'Aprano
On Sat, 4 Feb 2017 03:06 am, Neal Becker wrote: > I want to make sure any modules I build in the current directory overide > any > others. To do this, I'd like sys.path to always have './' at the > beginning. > > What's the best way to ensure this is alw

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Cameron Simpson
On 04Feb2017 10:13, Ben Finney wrote: Neal Becker writes: I want to make sure any modules I build in the current directory overide any others. To do this, I'd like sys.path to always have './' at the beginning. The ‘sys.path’ list is used only for *absolute* imports. Modules

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Wildman via Python-list
If you use >>>> /etc/rc.local, the execute bit must be set. >>> >>> I don't think this is what Neal Becker was asking about. He's talking >>> about the Python module search path (sys.path) not the operating system >>> PATH variable. Corre

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Ben Finney
Neal Becker writes: > I want to make sure any modules I build in the current directory > overide any others. To do this, I'd like sys.path to always have './' > at the beginning. The ‘sys.path’ list is used only for *absolute* imports. Modules in the current director

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Cameron Simpson
sking about. He's talking about the Python module search path (sys.path) not the operating system PATH variable. Correct me if I'm wrong. After re-reading the post I see you are correct. I will endeavor to read a little closer and a little slower in the future. Also, what you describ

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Wildman via Python-list
out. He's talking > about the Python module search path (sys.path) not the operating system > PATH variable. Correct me if I'm wrong. After re-reading the post I see you are correct. I will endeavor to read a little closer and a little slower in the future. -- GNU/Linux user #5

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Michael Torrie
On 02/03/2017 12:07 PM, Wildman via Python-list wrote: > Sorry, I forgot something important. If you use > /etc/rc.local, the execute bit must be set. I don't think this is what Neal Becker was asking about. He's talking about the Python module search path (sys.path) not the

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Wildman via Python-list
On Fri, 03 Feb 2017 12:58:15 -0600, Wildman wrote: > On Fri, 03 Feb 2017 11:06:00 -0500, Neal Becker wrote: > >> I want to make sure any modules I build in the current directory overide any >> others. To do this, I'd like sys.path to always have './' at the

Re: best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Wildman via Python-list
On Fri, 03 Feb 2017 11:06:00 -0500, Neal Becker wrote: > I want to make sure any modules I build in the current directory overide any > others. To do this, I'd like sys.path to always have './' at the beginning. > > What's the best way to ensure this is always

best way to ensure './' is at beginning of sys.path?

2017-02-03 Thread Neal Becker
I want to make sure any modules I build in the current directory overide any others. To do this, I'd like sys.path to always have './' at the beginning. What's the best way to ensure this is always true whenever I run python3? -- https://mail.python.org/mailman/listinfo/python-list

Re: Partially invalid sys.path - how can I fix it (not append to it)?

2015-09-28 Thread dieter
Pierre Rouleau writes: > On a OS/X 101.10.5 (Yosemite) system, the system Python just got updated to > 2.7.10 but it sys.path is partially invalid. How can I fix that? > ... details removed ... You have found out that the execution of "site.py" inserts the invalid entri

Partially invalid sys.path - how can I fix it (not append to it)?

2015-09-28 Thread Pierre Rouleau
Hi, On a OS/X 101.10.5 (Yosemite) system, the system Python just got updated to 2.7.10 but it sys.path is partially invalid. How can I fix that? I don't want to add something in PYTHONPATH. I know I can create a softlink at the invalid location to where the real files are located.I

Re: Non-unique dirs in sys.path

2015-01-10 Thread Terry Reedy
-c "import sys; [sys.stdout.write('%%s\n' %% p) for (i,p) in enumerate(sys.path)]" | sort --ignore-case which produces: f:\Documents and Settings\Gisle Vanem\Programdata\Python\Python27\site-packages f:\windows\system32\python27.zip<< !! doesn't exist, but okay.

Re: Non-unique dirs in sys.path

2015-01-09 Thread Ian Kelly
, which just >> contains the site-packages path. Removing that file solves the issue >> for me. > > > That was the case here too! Deleted my setuptools.pth and the "problem" > was gone. It would be nice to know how these .pth files are involved in > extending t

Re: Non-unique dirs in sys.path

2015-01-09 Thread Gisle Vanem
. That was the case here too! Deleted my setuptools.pth and the "problem" was gone. It would be nice to know how these .pth files are involved in extending the 'sys.path[]'. Who does that and how? Any good reference on that? -- --gv -- https://mail.python.org/mailman/listinfo/python-list

Re: Non-unique dirs in sys.path

2015-01-09 Thread Ian Kelly
On Fri, Jan 9, 2015 at 6:14 AM, Gisle Vanem wrote: > Why are these listed twice with different casing? One > would assume that Python on Win32 would be case-insensitive. > Some .pth-file to blame here? I checked my own Python 2.7 installation and discovered that I have the same problem, although

Non-unique dirs in sys.path

2015-01-09 Thread Gisle Vanem
%% p) for (i,p) in enumerate(sys.path)]" | sort --ignore-case which produces: f:\Documents and Settings\Gisle Vanem\Programdata\Python\Python27\site-packages f:\windows\system32\python27.zip<< !! doesn't exist, but okay. G:\Programfiler\Python27 g:\Programfiler\Py

Re: Add directory to sys.path based on variable

2014-01-30 Thread loial
Idiot that I am...I was not calling the script with the full path ! Thanks for your help -- https://mail.python.org/mailman/listinfo/python-list

Re: Add directory to sys.path based on variable

2014-01-30 Thread Tim Golden
> > import sys > import os > from os.path import * > > scriptpath=os.path.dirname(sys.argv[0]) > otherscriptspath=printerpath.replace("scripts","otherscripts") > sys.path.append(otherscriptspath) > > from AuditUpdate import * Well, adding a path

  1   2   3   4   >