Monthly Archives: January 2011

Bookmark Firefox Raib

Dalam dua hari terakhir seolah-olah ada setan di komputer saya. Setiap kali saya menutup Mozilla Firefox, bookmark selalu hilang. Saya restore dari backup tapi setelah restart Mozilla Firefox, hilang lagi.

Saya pakai Mozilla Firefox dengan profile khusus yang saya siapkan untuk dipakai sehari-hari, bisa di-share, dan digunakan untuk beberapa komputer; oh ya, tentu.. ada enkripsinya supaya hanya saya saja yang bisa pakai profile itu. Masalahnya, dengan embel-embel kustomisasi non-standard pabrikan Mozilla, saya bingung ini salah di program atau karena kustomisasi yang saya buat?

Masalah ini muncul setelah saya update Mozilla Firefox 3.6.13, jadi mungkin ada perilaku yang sebelumnya berfungsi sebelum versi 3.6.13 namun setelah versi ini tidak bisa lagi. Namun kustomisasi yang saya gunakan juga tidak terlalu njelimet amat; cuma script kecil supaya Mozilla Firefox memuat profile dari lokasi tertentu tempat volume ter-enkripsi di-mount. Jadi seharusnya tidak ada masalah, kecuali mulai versi 3.6.13 Mozilla Firefox menyimpan bookmark diluar dari lokasi profile.

Solusi

Setelah mencari-cari solusi di internet, sebenarnya tidak ada penjelasan secara pasti apa masalah saya. Tapi dari yang saya baca ada kemungkinan database SQLite yang dipakai untuk menyimpan bookmark sudah corrupt.

Hemmm… kalau begitu artinya SQLite tidak sepenuhnya “journal“… hmmm. Biarkan itu untuk bahan pemikiran lain waktu, namun untuk sekarang kemungkinan itu sangat terbuka.

Jadi pertama-tama saya rename file places.sqlite di dalam direktori profile saya. Setelah menjalankan Mozilla Firefox dengan cara biasa, yaitu dengan menggunakan profile khusus itu, file places.sqlite dibuat ulang dan saya bisa melakukan restore dengan mengambil bookmark dari tanggal sebelum saya update Mozilla Firefox. Hasilnya? Sukses, semua berjalan seperti biasa.

Nampaknya terbukti, file places.sqlite memang benar-benar corrupt dan saya —Mozilla Firefox— harus membuat file tersebut baru lalu melakukan restore dari backup sebelumnya.

Advertisements

Leave a comment

Filed under Ilmu, Orang bego punya kegiatan

Fixing PySide UI Code-Generator Error

Today while coding a program I’m working on I got this ImportError exception. It says it cannot find a module. It is one of those modules that supposed to be created automatically every time I hit the magic make button.

So this shift my curiosity to the build process: what went wrong in the building process?

This is the message that got my attention:

An unexpected error occurred.make[1]: *** [../../sekolah/app/qt/inputasalpendidikandlg_ui.py] Error 1
make: *** [qtappres] Error 2

This message must be the clue to the ImportError exception thrown by Python interpreter. So basically Python can’t import it because the build unable to create it in the first place.

Clues

The next logical thing is to try creating the UI module by hand, with debug message, so:

$ pyside-uic -d resources/qt/ui/inputasalpendidikandlg.ui

gave me:

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'resources/qt/ui/inputasalpendidikandlg.ui'
#
# Created: Tue Jan 14 23:33:06 2011
#      by: PySide uic UI code generator
#
# WARNING! All changes made in this file will be lost!

Traceback (most recent call last):
  File "/usr/bin/pyside-uic", line 75, in main
    options.indent)
  File "/usr/bin/pyside-uic", line 39, in generateUi
    pysideuic.compileUi(uifname, pyfile, execute, indent)
  File "/usr/lib/pymodules/python2.6/pysideuic/__init__.py", line 73, in compileUi
    winfo = compiler.UICompiler().compileUi(uifile, pyfile)
  File "/usr/lib/pymodules/python2.6/pysideuic/Compiler/compiler.py", line 37, in __init__
    CompilerCreatorPolicy())
  File "/usr/lib/pymodules/python2.6/pysideuic/uiparser.py", line 104, in __init__
    self.factory = QObjectCreator(creatorPolicy)
  File "/usr/lib/pymodules/python2.6/pysideuic/objcreator.py", line 79, in __init__
    raise WidgetPluginError, "%s: %s" % (e.__class__, str(e))
WidgetPluginError: : 'pluginType'

Hmm.. this is far more complicated than I thought. It seems, the faulty went straight to the PySide code. Because when I tried the same ui file with PyQt4’s pyuic4 it generate the module just fine.

Solving It

After reading the code on /usr/lib/pymodules/python2.6/pysideuic/objcreator.py and comparing it to PyQt4’s I found, semantically, they are doing the same thing. So the code is good, unless I missed something, which is hardly possible because both code are written nicely.

Now I know that this thing load plug-ins, by means of reading Python modules in a certain path. Putting some default variables and taking it back from the plug-in and basically do something against that. Nothing uncanny here, so what’s the big deal?

So I browse to the directory where it load its plug-ins: /usr/lib/pymodules/python2.6/pysideuic/widget-plugins/.

This is what I found:

$ ls
__init__.py	__init__.pyc	qtwebkit.py	qtwebkit.pyc

Aha! The __init__.py module being nothing more than a empty module (with its “compiled” __init__.pyc) is the culprit here. The objcreator.py executes __init__.py causing exception because the loader code expect variable pluginType to be defined by the plug-in, which in this case is an empty file.

So the easiest solution is to remove __init__.py and __init__.pyc from widget-plugins directory. At first I move the two to /tmp/ just in case something break badly I can put it back in, but after seeing make working as intended I delete them immediately.

Another alternative is to modify objcreator.py to remove __init__.py from “plugins” after enumerating files from the widget-plugins directory.

Leave a comment

Filed under Ilmu, Orang bego punya kegiatan