Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#25054 - [Python] class/instance ... has no attribute '_...'

Attached to Project: Arch Linux
Opened by Andreas Hasenkopf (CrazyScientist) - Thursday, 07 July 2011, 11:22 GMT
Last edited by Stéphane Gaudreault (stephane) - Monday, 11 July 2011, 16:17 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Stéphane Gaudreault (stephane)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
On several occasions I discountered a "very serious" problem regarding modules. The interpreter is complaining about the following AttributeError:

"class/instance xyz has no attribute '_abc'"

For example xml.sax.saxutils.XMLGenerator (=xyz) and any method/attribute beginning with an underscore (=_abc)

I also encountered this problem with matplotlib's TeX formatting of text.

Additional info:
* package version(s)
python2 2.7.2-2
python2-numpy 1.5.1-2
python2-scipy 0.9.0-1
python2-matplotlib 1.0.1-2
* config and/or log files etc.


Steps to reproduce:
- Import xml.sax.saxutils
- Initiate XMLGenerator()
- Call _write() method thereof or any other method/attribute beginning with an underscore

or

- Run my script: http://sourceforge.net/projects/emcdutilityprog/files/eels.tar.gz/download
- Open settings dialog
- Save settings
This task depends upon

Closed by  Stéphane Gaudreault (stephane)
Monday, 11 July 2011, 16:17 GMT
Reason for closing:  Works for me
Additional comments about closing:  I am closing this as "work for me", please feel free to reopen and add more informations if needed.
Comment by Andreas Hasenkopf (CrazyScientist) - Thursday, 07 July 2011, 13:22 GMT
The problem seems to be in the precompiled Python package in the repository.
Downloading a recent version of Python 2.7.2 from python.org and compiling it results in an interpreter not showing this bug.
Comment by Stéphane Gaudreault (stephane) - Thursday, 07 July 2011, 14:14 GMT
It seems to work here :

- python2 emcd.py
- Open settings dialog
- Save settings

No crash and I got a file ~/.config/eels/eels-settings.xml
<?xml version="1.0" encoding="utf-8"?>
<EELS-GUI-Settings>
<backgr_model>0</backgr_model>
<emcd_subplot>True</emcd_subplot>
<emcd_sig_mag>5.7</emcd_sig_mag>
<filter_model>1</filter_model>
<show_unprocessed>True</show_unprocessed>
<emcd_definition>True</emcd_definition>
<gauss_kernel>1.0</gauss_kernel>
</EELS-GUI-Settings>

To help the discussion, could you please provide me a minimal example (a few lines) that crash for you ?
Comment by Andreas Hasenkopf (CrazyScientist) - Thursday, 07 July 2011, 15:44 GMT
I attached a file with 3 examples:
The first example is with the interpreter from the package, the second one contains a Traceback emitted by my script upon applying new settings and the third one is the same code as in the first example but with an interpreter compiled on my machine.

I hope it helps...
Comment by Stéphane Gaudreault (stephane) - Thursday, 07 July 2011, 20:09 GMT
I cannot reproduce the problem. Your example works here :

# python2
Python 2.7.2 (default, Jun 12 2011, 03:11:18)
[GCC 4.6.0 20110603 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.sax.saxutils
>>> x= xml.sax.saxutils.XMLGenerator()
>>> x._write("Hello World")
Hello World>>>

Tested on 2 laptops, same result on both i686 and x86_64 with python2 2.7.2-2.

Works also with python python 3.2-2.
Comment by Andreas Hasenkopf (CrazyScientist) - Friday, 08 July 2011, 09:30 GMT
Well, this seems to be a bit odd, but it explains why nobody else has experienced similar problems. At the moment I do not have a second machine with Arch installed on, so I cannot try it on another machine myself, yet.

If you are interested in investigating this problem further, I have attached my /proc/cpuinfo.

In the meantime I will simply replace the python package with the self-compiled one...

Thanks so far
   cpuinfo (1.5 KiB)
Comment by Andreas Hasenkopf (CrazyScientist) - Friday, 08 July 2011, 10:30 GMT
I just made a very interesting discovery after replacing the packaged python with the self-compiled on:

Notice the difference between those two examples:

andi@x200:~$ python2.7
Python 2.7.2 (default, Jul 7 2011, 15:17:24)
[GCC 4.6.1] on linux2
>>> import xml.sax.saxutils
>>> x=xml.sax.saxutils.XMLGenerator()
>>> x._write("Hallo")
Hallo>>>

andi@x200:~$ python2
Python 2.7.2 (default, Jul 8 2011, 12:22:00)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.sax.saxutils
>>> x=xml.sax.saxutils.XMLGenerator()
>>> x._write("Hallo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: XMLGenerator instance has no attribute '_write'
Comment by Andreas Hasenkopf (CrazyScientist) - Friday, 08 July 2011, 10:36 GMT
As it appears, the python2.7 command refers to yesterday's build, which is located in /usr/local/bin, whereas python2 refers to python2.7 in /usr/bin, where today's build is located...
Comment by Stéphane Gaudreault (stephane) - Saturday, 09 July 2011, 15:11 GMT
Can you reproduce the problem in a clean/minimal chroot ?

1) sudo pacman -S devtools

2) Create a chroot:

sudo mkarchroot -C /usr/share/devtools/pacman-extra.conf ~/chroot_test 'base python2'

3) login into the chroot :

sudo mkarchroot -r /bin/bash ~/chroot_test

4) . /etc/profile
and then test python2 package.
Comment by Andreas Hasenkopf (CrazyScientist) - Monday, 11 July 2011, 15:45 GMT
Sorry, as this is the Linux machine I use for my PhD thesis I decided to migrate to another distro: On Friday I installed Fedora 15, where I experienced some other issues with matplotlib and SELinux, which made me install Ubuntu 10.04 on Saturday morning.

Before this installation orgy I removed all python-relevant packages except the python2 package itself using pacman. Under these conditions I also could run the examples posted above. I tried to install the previously removed packages one by one to determine the "malicious" one. As some have complex dependencies (can't install one by one) I ran into some problems with pacman when I tried to remove single packages again: pacman could not resolve the dependencies and remove them...

The actual problem seem to be in another package.

Loading...