Re: PEP 338: Executing modules inside packages with '-m'

2004-12-15 Thread Nick Coghlan
Martin Bless wrote: [Nick Coghlan <[EMAIL PROTECTED]>] One thing I stumbled across with the current implementation: Why doesn't "python -m abc" work with ./abc/ ./abc/__init__.py assuming ./abc/ is directly on the path? In analogy to normal module import? It doesn't work because abc is a package, r

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-14 Thread Fredrik Lundh
Martin Bless wrote: > On my Windows machine this command line switch really makes my life so > much easier. if you use windows, chances are that what you really want is exemaker... -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-14 Thread Martin Bless
[Nick Coghlan <[EMAIL PROTECTED]>] >Python 2.4's -m command line switch only works for modules directly on >sys.path. On my Windows machine this command line switch really makes my life so much easier. I appreciate -m very much. Going further as proposed in PEP 338 sounds good to me. One thing

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-14 Thread Just
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > Just wrote: > > > >> as for the rest of your arguments, I have to assume that you were joking. > >> (or > >> that you have no experience whatsoever of distribution of Python programs > >> in > >> Unix and Windows envi

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-14 Thread Just
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > Nick Coghlan wrote: > > >> $ python -c "import foo.bar" arg > > > > This doesn't work. Any code protected by "if __name__ == '__main__':" won't > > run in this context > > (since 'foo.bar' is being imported as a m

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Nick Coghlan
Fredrik Lundh wrote: in my original post, I said I'd say that for a typical user, "A" is a marginal improvement over "B", compared to "C". which, I thought, tried to say that for a user expecting "C", neither "A" nor "B" is good enough. Ah, OK - that makes a lot more sense than the way I r

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Fredrik Lundh
Just wrote: > This subthread was specifically about your > > python -c "import foo.bar" arg > > suggestion. in my original post, I said I'd say that for a typical user, "A" is a marginal improvement over "B", compared to "C". which, I thought, tried to say that for a user expecting "C

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Nick Coghlan
Fredrik Lundh wrote: my suggestion was to make sure that the user can type "bar arg" to start a Python program called "bar" with the argument "arg". that's trivial, on all major platforms, despite what Nick says -- and yes, you can start threads from a program named "bar". try it. The command lin

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Fredrik Lundh
Just wrote: >> as for the rest of your arguments, I have to assume that you were joking. >> (or >> that you have no experience whatsoever of distribution of Python programs in >> Unix and Windows environments). > > Whatever. You suggestion does not work in many cases. How about a > program that s

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Fredrik Lundh
Nick Coghlan wrote: >> $ python -c "import foo.bar" arg > > This doesn't work. Any code protected by "if __name__ == '__main__':" won't > run in this context > (since 'foo.bar' is being imported as a module, not run as a script). I appreciate that you're taking the time to teach me about Py

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-13 Thread Nick Coghlan
Fredrik Lundh wrote: I'd say that for a typical user, $ python -m foo.bar arg is a marginal improvement over $ python -c "import foo.bar" arg This doesn't work. Any code protected by "if __name__ == '__main__':" won't run in this context (since 'foo.bar' is being imported as a module, not

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-12 Thread richard
[EMAIL PROTECTED] wrote: > A useful feature that is a logical extension of current '-m' behaviour. > (I'm actually surprised it was left out in the first place) > > This will definitely allow me and other python programmers to package > our scripts better > > Sounds Good to me. (-; /me too :)

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-12 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > This will definitely allow me and other python programmers to package > our scripts better puzzling. I'd say that for a typical user, $ python -m foo.bar arg is a marginal improvement over $ python -c "import foo.bar" arg compared to $ bar arg --

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-11 Thread Nick Coghlan
[EMAIL PROTECTED] wrote: A useful feature that is a logical extension of current '-m' behaviour. (I'm actually surprised it was left out in the first place) That seems to be a common reaction :) It was dropped for 2.4 because I wasn't sure exactly how it should work, and 2.4 was already in beta at

Re: PEP 338: Executing modules inside packages with '-m'

2004-12-11 Thread alia_khouri
A useful feature that is a logical extension of current '-m' behaviour. (I'm actually surprised it was left out in the first place) This will definitely allow me and other python programmers to package our scripts better Sounds Good to me. (-; Thank you for the PEP AK -- http://mail.python.or

PEP 338: Executing modules inside packages with '-m'

2004-12-11 Thread Nick Coghlan
Python 2.4's -m command line switch only works for modules directly on sys.path. Trying to use it with modules inside packages will fail with a "Module not found" error. This PEP aims to fix that for Python 2.5. Previously, posting of a draft version of the PEP to python-dev and python-list did