Ubuntu removing XML from Python?

From http://159.18.52.69/raw/983493

Error:


Traceback (most recent call last):
  File "test.py", line 12, in module
    from xml.dom.ext.reader import HtmlLib
ImportError: No module named ext.reader

Fix/workaround:


+        sys.path.append('/usr/lib/python%s/site-packages/oldxml' % sys.version[:3])
        from xml.dom.ext.reader import HtmlLib

I had an old Python script doing some XML work and after upgrade to Ubuntu 8.04 I started getting the above error message and had to use the above fix because the Ubuntu packages of python-xml moved the xml.dom.ext.* to /usr/lib/python2.5/site-packages/oldxml for some reason. Have not looked at the latest Debian packages. Does anyone know why such back-compatibility breaking change was introduced? All I find on Google are the people getting bitten by this bug and no reasoning or even discussion behind the change.

Popularity: 29% [?]


SBackup new beta - test and translate please!

With great help from Ouattara Oumar Aziz an new version of SBackup is shaping up in the svn repo and a day ago I created a public beta version - 0.10.4~beta10 which can be downloaded here.
Please report any bugs or regressions to Sourceforge bug tracker. Also an update for translations and new translations can be added. You can either translate in Launchpad or download the template file from the SVN. But beware that there are more translations in Launchpad then in the SVN at the moment, so check there first.
If no blocker bugs are found, we could see a new stable release of SBackup in a weeks time. I am sure that a lot of people will be happy to hear that :).

Edit: For some reason, the DEB on the Sourceforge site was cut to third of its size, I uploaded a new version, it should be fine now. And by popular request here is a screenshot, note that by using simple timing the /etc/cron.{daily,weekly,monthly} folders are used and thus anacron runs the backups if the computer was off at the scheduled time.
New screenshot

Popularity: 41% [?]


Why? Oh Gods! Why?


$ mv .ssh/ .ssh.old/
$ python
>>>import gnomevfs
>>> gnomevfs.get_file_info( "ssh://aigarius:password@aigarius.com/home/aigarius" )
Traceback (most recent call last):
File "<stdin>", line 1, in ?
gnomevfs.AccessDeniedError: Access denied
>>>
$ ssh aigarius.com
The authenticity of host 'aigarius.com (85.254.216.40)' can't be established.
RSA key fingerprint is 6d:29:c0:f3:d0:84:c9:a9:d9:4c:7e:e3:1a:18:a2:e2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'aigarius.com,85.254.216.40' (RSA) to the list of known hosts.
aigarius@aigarius.com's password: *******
[...]
aigarius.com$ exit
$ python
>>>import gnomevfs
>>> gnomevfs.get_file_info( “ssh://aigarius:password@aigarius.com/home/aigarius” )
<gnomevfs .FileInfo ‘aigarius’>
>>>

Of course, this is mentioned nowhere in the sparse documentation. Please keep me away from the person who wrote GnomeVFS and its Python bindings. Bloodshed might ensue. Bug reported

Why can’t someone write a nice, light, working network file transfer protocol abstraction library that would be independent of any desktop environment (bonus) and a working X server (I am looking at you, GnomeVFS). Something that would simply provided all file and folder manipulation operations in sync and async ways in such way that those operations work completely uniformly across all supported protocols. Support for at least ssh and ftp is essential, webdav, nfs, rsync and other protocols that allow writing files to remote locations and http, https and other protocols that only allow read only access to remote files would be very welcome. The library should be in C with bindings in C++, Python, Perl, Ruby, PHP and also a command line processor that would allow all commands to be used in a shell script.
Why something like this can not be written and obsolete the GnomeVFS and those KIOslaves. Freedesktop.org, I am looking at you, please!

Update: Apparently I only need to “import gnome.ui” and execute “gnome.ui.authentication_manager_init()” and my application will automagically get a proper authentication dialog in this case. Unfortunately it is not documented anywhere that I could find. :P

Popularity: 46% [?]


Another tiny note - why is it so that al…

Another tiny note - why is it so that all the Python wrappers for Gnome and Freedesktop related things (GnomeVFS and DBus in my experience) have absolutely no API documentation !!! PyGTK has a nice set of documentation for GTK work, but it doesn’t extend beyond that, sadly. When I was writing SBackup, I had to resort to using Python build-in function dir() to show me what names the gnomevfs module exported and guestimate my way from there. That was ugly as hell, but worked. Now I am trying to find any information about that “new” DBus thing that everyone was so excited about approximately a year ago - I can only find a few blog posts about rewrites of said API and a few simple programs that do not even work with the rewritten API. I mean - I can understand not having documentation for internal functions of a desktop program, but not having a public API document for a critical library of freedesktop.org desktop infrastructure - that is just plain dumb.

Edit: It seams that there is some kind of dbus tutorial with Python API section. I do not know, why it didn’t appear on first 10 pages of Google search for “dbus python” or “dbus python API”, but I hope this linking will help that a bit. Also, we will see, how useful it actually is - the rest of the document itself is quite cryptic to me.

Edit2: I am impressed, the Python chapter is definitely written by someone different from those that wrote the rest of the dbus tutorial - this part actually makes sense, is very detailed and hand-holding when it is needed. i got almost all my questions answered. Thanks to whoever wrote that!

Popularity: 23% [?]


I am behind my planned schedule by allmo…

I am behind my planned schedule by allmost two days, mostly because tarfile module for Python is … not too complete, for example you can only extract files one by one :P
It looks like I will have to implement extraction of directories myself. Of course I will send it to the tarfile upstream authors, along with something heavy …

Popularity: 24% [?]


Still writing a restore tool :(

Still writing a restore tool :(
Last two hours were spent debugging an interesting problem with TreeView in PyGTK. It was too slow to parse and add all files from a backup snapshot to the tree view at once (not to mention that it took 35 Mb of RAM :P), so I decided to load the tree as needed - I would add the children of a node only when this node gets expanded. So I happily wrote a handler to ‘row-expanded’ event that does just that - adds some children to the newly expanded node.
Note: as the node cannot expand if it doesn’t have some children already, I also add a dummy child to all directory nodes
Then the problem came up - once I enabled my handler, the nodes would not expand anymore: the expansion handles were there, I could click on them and see the CPU being chewed away by the parsing of the 6 Mb nodelist, but nothing changed in the interface - even the dummy node didn’t come up.
That confused not only me, but also #pygtk people. I wrote a 15 line simple script to replicate the problem, but everything worked fine there :O. At this point I started commenting stuff out at random and found out that breaking the link between treestore and treeview (recommended in docs to avoid excessive updates) resets the expansion state. Doh.
But it was not the end yet. After that I noticed that the nodes didn’t expand on the first try, but only on the second. 8) After some mental mummbo-jummbo I came to an idea that proved to be dumb, but correct. Prepare for a gem boys and girls - if, in the process of execution of row-expanded handler, at at least one point the expanding node has no children (like when you have removed the dummy node, but still haven’t added the real ones) - the expansion doesn’t happen!
Two bugs^Wfeatures with the same effect. Oh, the fun of debugging never stops :D

Popularity: 26% [?]