Re: __pycache__, one more good reason to stck with Python 2?
- From: jmfauth <wxjmfauth@xxxxxxxxx>
- Date: Wed, 19 Jan 2011 11:12:52 -0800 (PST)
On Jan 19, 7:03 pm, Antoine Pitrou <solip...@xxxxxxxxxx> wrote:
On Wed, 19 Jan 2011 08:30:12 -0800 (PST)
jmfauth <wxjmfa...@xxxxxxxxx> wrote:
Yes, I can launch a pyc, when I have a single file.
But what happens, if one of your cached .pyc file import
a module with a name as defined in the parent directory?
The machinery is broken. The parent dir is not in the
sys.path.
Well, you don't have to launch a pyc file anyway. Put all your code in
some (pyc) modules on the standard Python path, and use a clear-text
script with some trivial code to invoke a function from the compiled
modules.
That's not the point. I'm toying. And the "behaviour" from now
is deeply different from what it was.
Otherwise you can customize sys.path a little from your script,
using __file__ and os.path.dirname. Nothing complicated AFAICT.
That's not as simple. You have too prepare the py file in such a way,
that it recognizes the path of its ancestor py file. The "home dir"
is no more the same.
(by the way, the fact that pyc files are version-specific should
discourage any use outside of version-specific directories,
e.g. /usr/lib/pythonX.Y/site-packages)
Here we are. I'm just wondering if all this stuff is not just
here in order to satisfy the missmatched Python installation on
*x platforms compared to Windows whre each Python version
lives cleanely in its isolated space. (Please no os war).
jmf
compared to
.
- References:
- __pycache__, one more good reason to stck with Python 2?
- From: jmfauth
- Re: __pycache__, one more good reason to stck with Python 2?
- From: Steven D'Aprano
- Re: __pycache__, one more good reason to stck with Python 2?
- From: jmfauth
- Re: __pycache__, one more good reason to stck with Python 2?
- From: Terry Reedy
- Re: __pycache__, one more good reason to stck with Python 2?
- From: Ben Finney
- Re: __pycache__, one more good reason to stck with Python 2?
- From: Terry Reedy
- Re: __pycache__, one more good reason to stck with Python 2?
- From: jmfauth
- Re: __pycache__, one more good reason to stck with Python 2?
- From: Steven D'Aprano
- Re: __pycache__, one more good reason to stck with Python 2?
- From: jmfauth
- Re: __pycache__, one more good reason to stck with Python 2?
- From: Antoine Pitrou
- __pycache__, one more good reason to stck with Python 2?
- Prev by Date: Re: UTF-8 question from Dive into Python 3
- Next by Date: Re: [OT] Python like lanugages [was Re: After C++, what with Python?]
- Previous by thread: Re: __pycache__, one more good reason to stck with Python 2?
- Next by thread: Re: __pycache__, one more good reason to stck with Python 2?
- Index(es):
Relevant Pages
|