You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 2.5.2a0 (release25-maint, Nov 27 2007, 14:00:00)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.match.func_code.co_filename
'/usr/local/lib/python2.5/re.py'
>>>
thekorn commented on Dec 19, 2007
thekornmannequin
MannequinAuthor
More actions
Thanks for your fast reply.
I'm using the python package of ubuntu-feisty,
$ python
Python 2.5.1 (r251:54863, Oct 5 2007, 13:50:07)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.match.func_code.co_filename
're.py'
>>>
I'm able to reproduce the problem on Ubuntu. It's probably caused by
their compile step in python2.5.postinst:
cd /usr/lib/python2.5
files=$(dpkg -L python2.5 | sed -n
'/\.py$/s,^/usr/lib/python2.5/,,p')
/usr/bin/python2.5 /usr/lib/python2.5/py_compile.py $files
if grep -sq '^byte-compile[^#]*optimize'
/etc/python/debian_config; then
/usr/bin/python2.5 -O /usr/lib/python2.5/py_compile.py $files
fi
It's compiling the py files relative to /usr/lib/python2.5. Please note
that the behavior of py_compile.py is intended. The relative path is
useful for people who pack the compiled files into a zip file or egg file.
Well, if they do that, they apparently break inspect.py. Should they
be doing that? Why are they doing that? Can you contact the Ubuntu
folks about this?
Well, if they do that, they apparently break inspect.py. Should they
be doing that? Why are they doing that? Can you contact the Ubuntu
folks about this?
No, they shouldn't. It may be plain ignorance or they have a hidden
agenda. I'm going to contact the Debian maintainers. I'm sure the Ubuntu
guys have copied the behavior from Debian.
Activity
thekorn commentedon Dec 19, 2007
re.match.func_code.co_filename returns "re.py"
I expect something like "/usr/lib/python2.5/re.py"
This causes issues in the "inspect"-module like: >>> inspect.getabsfile(re.match) >>> '<current-dir>/re.py'Sorry, this is my first python-bugreport, please ping me if you need any
further details.
Markus
gvanrossum commentedon Dec 19, 2007
I can't reproduce this.
How did you install Python?
Python 2.5.2a0 (release25-maint, Nov 27 2007, 14:00:00) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> re.match.func_code.co_filename '/usr/local/lib/python2.5/re.py' >>>thekorn commentedon Dec 19, 2007
Thanks for your fast reply. I'm using the python package of ubuntu-feisty, $ python Python 2.5.1 (r251:54863, Oct 5 2007, 13:50:07) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> re.match.func_code.co_filename 're.py' >>>So maybe it's ubuntu-specific!?
gvanrossum commentedon Dec 19, 2007
Then I suggest you talk to the Ubuntu developers or whoever packaged
Python 2.5.1 for it.
tiran commentedon Dec 20, 2007
I'm able to reproduce the problem on Ubuntu. It's probably caused by
their compile step in python2.5.postinst:
'/\.py$/s,^/usr/lib/python2.5/,,p')
/usr/bin/python2.5 /usr/lib/python2.5/py_compile.py $files
if grep -sq '^byte-compile[^#]*optimize'
/etc/python/debian_config; then
/usr/bin/python2.5 -O /usr/lib/python2.5/py_compile.py $files
fi
It's compiling the py files relative to /usr/lib/python2.5. Please note
that the behavior of py_compile.py is intended. The relative path is
useful for people who pack the compiled files into a zip file or egg file.
gvanrossum commentedon Dec 20, 2007
Well, if they do that, they apparently break inspect.py. Should they
be doing that? Why are they doing that? Can you contact the Ubuntu
folks about this?
tiran commentedon Dec 20, 2007
Guido van Rossum wrote:
No, they shouldn't. It may be plain ignorance or they have a hidden
agenda. I'm going to contact the Debian maintainers. I'm sure the Ubuntu
guys have copied the behavior from Debian.
Christian
tiran commentedon Dec 20, 2007
I proposed to the maintainer that he should change one line to
In the mean time you can easily fix the issue with:
sudo find /usr/lib/python2.5 -name '*.py[co]' -delete
sudo python2.5 /usr/lib/python2.5/compileall.py /usr/lib/python2.5/
sudo python2.5 -O /usr/lib/python2.5/compileall.py /usr/lib/python2.5/
thekorn commentedon Dec 20, 2007
Thanks a lot, this works.
Markus