I'll have to check that out. It looks like it would work fine for my purposes
since I normally run from virtual envs, but could be restrictive in that the
user site-packages isn't added.
I also found some other mentions of this:
https://bugs.python.org/issue33053https://bugs.python.org/issue13475
I guess I'm confused if you want (e.g.) `python json.py` to do something
but not `python -m json` to call the same file (a different way), given
you're in the directory.
nick@lappy386:~/Code$ echo "{}" | python -m json.tool
{}
nick@lappy386:~/Code$ touch json.py
nick@lappy386:~/Code$ echo "{}" | p
I see... never use this feature.
I make extensive use of running modules from local (non-PYTHONPATH)
directories. When these modules import (local) sub-modules, the best and
simplest method I have found is running them from top directory of the
corresponding application. I can run any module in
Eryk Sun wrote:
> On 2/24/20, jdve...@gmail.com jdve...@gmail.com wrote:
> >
> > It is the intended and the expected behaviour. The
> > working directory is
> > always added to the sys.path.
> > You mean always in this particular context, i.e. the working directory
> is added normally when executin
On Mon, Feb 24, 2020 at 6:04 PM Eryk Sun wrote:
> On 2/24/20, jdve...@gmail.com wrote:
> >
> > I try to use along with -m (`python -I -m a.b`) and get this error:
> "python:
> > Error while finding module specification for 'a.b' (ModuleNotFoundError:
> No
> > module named 'a')".
>
> This is a us
On 2/24/20, jdve...@gmail.com wrote:
>
> I try to use along with -m (`python -I -m a.b`) and get this error: "python:
> Error while finding module specification for 'a.b' (ModuleNotFoundError: No
> module named 'a')".
This is a use case for -m that requires adding the working directory
to sys.pat
On 2/24/20, jdve...@gmail.com wrote:
>
> It is the intended and the expected behaviour. The working directory is
> always added to the sys.path.
You mean always in this particular context, i.e. the working directory
is added normally when executing a command via -c or a module as a
script via -m.
Nick Timkovich wrote:
> > Are you familiar with the -I option for "isolated mode"?
> https://docs.python.org/3/using/cmdline.html#id2
> -I
> Run Python in isolated mode. This also implies -E and -s. In isolated mode
> sys.path contains neither the script’s directory nor the user’s
> site-packages
On Mon, Feb 24, 2020 at 11:51 AM Brianvanderburg2 via Python-ideas <
python-ideas@python.org> wrote:
> When running a python script directly, the directory of that script gets
> added to sys.path. When running as a module "python -m", it looks like an
> empty string gets added to sys.path, which
Brianvanderburg2 wrote:
> This is just an idea, which may not in practice be a major problem but can at
> times be
> an inconvenience. I thought I had posted this in the "python -m" thread a
> little while
> back but checking my history it does't appear I did, I do apologize if this
> is a
> du
10 matches
Mail list logo