Viewing posts for the category python

Going to Debconf14

It's that time of the year, again, when I lan to go to Debconf, reserve vacation, get visa waiver, book tickets. Let's hope nothing blocks me from attending this time. It has been too long.

Photo migration from Flickr to Google Plus

I've been with Flickr since 2005 now, posting a lot of my photos there, so that other poeple from the events, that I usually take photos of, could enjoy them. But lately I've become annoyed with it. It is very slow to uplaod to and even worse to get photos out of it - there is no large shiny button to Download a set of photos, like I noticed in G+. So I decided to try and copy my photos over. I am not abandoning or deleting my Flickr account yet, but we'll see.

Moved to Mezzanine

After my server that has hosted my blog for some years had given out its last breath (second motherboard failure), I decited it was time for a change. And not just server change, but also change in the blog engine itself. As I now focus on Python and Django almost exclusively at work, it felt logical to use some kind of Django-based blog or CMS. I tried django-cms and mezzanine and ... Mezzanine is so fast and simple, that I simply stopped looking.

Debug and optimization do NOT mix!

This has robbed me of several days of my life, so I want to bring Google juice this this problem.

Ubuntu removing XML from Python?


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 :).

Why? Oh Gods! Why?

$ mv .ssh/ .ssh.old/
$ python
>>>import gnomevfs
>>> gnomevfs.get_file_info( "ssh://" )
Traceback (most recent call last):
File "<stdin>", line 1, in ?
gnomevfs.AccessDeniedError: Access denied
$ ssh
The authenticity of host ' (' 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 ',' (RSA) to the list of known hosts.'s password: *******
[...]$ exit
$ python
>>>import gnomevfs
>>> gnomevfs.get_file_info( "ssh://" )
<gnomevfs .FileInfo 'aigarius'>

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 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!

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 ...

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

Recent Posts






RSS / Atom