GNOME Bugzilla – Bug 524665
Unable to import 'main' on startup
Last modified: 2008-10-27 06:47:20 UTC
Version: 2.22.0 What were you doing when the application crashed? closed Distribution: Ubuntu 8.04 (hardy) Gnome Release: 2.22.0 2008-03-17 (Ubuntu) BugBuddy Version: 2.22.0 System: Linux 2.6.24-12-generic #1 SMP Wed Mar 12 22:31:43 UTC 2008 x86_64 X Vendor: The X.Org Foundation X Vendor Release: 10400090 Selinux: No Accessibility: Disabled GTK+ Theme: Glossy Icon Theme: gnome Memory status: size: 0 vsize: 0 resident: 0 share: 0 rss: 0 rss_rlim: 0 CPU usage: start_time: 0 rtime: 0 utime: 0 stime: 0 cutime:0 cstime: 0 timeout: 0 it_real_value: 0 frequency: 0 ----------- .xsession-errors --------------------- ![1206633412,000,xklavier_evt_xkb.c:xkl_xkb_process_x_event/] ATTENTION! Currently cached group 0 is not equal to the current group from the event: 1 ![1206633413,000,xklavier_evt_xkb.c:xkl_xkb_process_x_event/] ATTENTION! Currently cached group 0 is not equal to the current group from the event: 1 ![1206633413,000,xklavier_evt_xkb.c:xkl_xkb_process_x_event/] ATTENTION! Currently cached group 0 is not equal to the current group from the event: 1 ![1206633422,000,xklavier_evt_xkb.c:xkl_xkb_process_x_event/] ATTENTION! Currently cached group 0 is not equal to the current group from the event: 1 ![1206633422,000,xklavier_evt_xkb.c:xkl_xkb_process_x_event/] ATTENTION! Currently cached group 0 is not equal to the current group from the event: 1 ![1206633424,000,xklavier_evt_xkb.c:xkl_xkb_process_x_event/] ATTENTION! Currently cached group 0 is not equal to the current group from the event: 1 ![1206633424,000,xklavier_evt_xkb.c:xkl_xkb_process_x_event/] ATTENTION! Currently cached group 0 is not equal to the current group from the event: 1 ![1206633424,000,xklavier_evt_xkb.c:xkl_xkb_process_x_event/] ATTENTION! Currently cached group 0 is not equal to the current group from the event: 1 ![1206633425,000,xklavier_evt_xkb.c:xkl_xkb_process_xTraceback (most recent call last):
+ Trace 193467
start_game()
import main
-------------------------------------------------- Traceback (most recent call last):
*** Bug 525090 has been marked as a duplicate of this bug. ***
*** Bug 526288 has been marked as a duplicate of this bug. ***
What appears to be happening here is the first glchess module is loaded (glchess.py) but the second one fails. Compare to bug 412690 where the first one was failing. I cannot work out how this is occuring... Question: Was anyone upgrading when this occured, i.e. were half of the glchess modules on the disk at time of execution? There are two solutions to this: 1. Take the 'import main' out of start_game() so it is caught when glchess.py is imported. 2. Catch ImportError exceptions during program execution. Number 2 is probably the safest though it really just hides the problem from the GNOME developers - if glchess is properly installed and your hardware is functional you should never get an ImportError. If we do hide problems we need to implement bug 519185 so the users/distributions have a better chance of diagnosing problems.
*** Bug 527134 has been marked as a duplicate of this bug. ***
*** Bug 527220 has been marked as a duplicate of this bug. ***
Moved the import in 2.22.2: http://svn.gnome.org/viewvc/gnome-games?view=revision&revision=7608 This should cause the "improperly installed" error dialog to be displayed instead of the crash. Don't know why this problem is occurring though.
*** Bug 528265 has been marked as a duplicate of this bug. ***
*** Bug 529208 has been marked as a duplicate of this bug. ***
*** Bug 529612 has been marked as a duplicate of this bug. ***
*** Bug 529927 has been marked as a duplicate of this bug. ***
*** Bug 529952 has been marked as a duplicate of this bug. ***
*** Bug 530115 has been marked as a duplicate of this bug. ***
*** Bug 530204 has been marked as a duplicate of this bug. ***
*** Bug 530440 has been marked as a duplicate of this bug. ***
*** Bug 530354 has been marked as a duplicate of this bug. ***
*** Bug 530551 has been marked as a duplicate of this bug. ***
*** Bug 530913 has been marked as a duplicate of this bug. ***
*** Bug 531093 has been marked as a duplicate of this bug. ***
*** Bug 531121 has been marked as a duplicate of this bug. ***
*** Bug 531126 has been marked as a duplicate of this bug. ***
*** Bug 531160 has been marked as a duplicate of this bug. ***
*** Bug 531207 has been marked as a duplicate of this bug. ***
*** Bug 531367 has been marked as a duplicate of this bug. ***
*** Bug 531368 has been marked as a duplicate of this bug. ***
*** Bug 531463 has been marked as a duplicate of this bug. ***
*** Bug 531452 has been marked as a duplicate of this bug. ***
*** Bug 531451 has been marked as a duplicate of this bug. ***
*** Bug 531450 has been marked as a duplicate of this bug. ***
*** Bug 531652 has been marked as a duplicate of this bug. ***
*** Bug 531659 has been marked as a duplicate of this bug. ***
*** Bug 531661 has been marked as a duplicate of this bug. ***
*** Bug 531890 has been marked as a duplicate of this bug. ***
*** Bug 532195 has been marked as a duplicate of this bug. ***
*** Bug 532244 has been marked as a duplicate of this bug. ***
*** Bug 532269 has been marked as a duplicate of this bug. ***
*** Bug 532400 has been marked as a duplicate of this bug. ***
*** Bug 532419 has been marked as a duplicate of this bug. ***
*** Bug 532456 has been marked as a duplicate of this bug. ***
*** Bug 532728 has been marked as a duplicate of this bug. ***
*** Bug 532648 has been marked as a duplicate of this bug. ***
*** Bug 532912 has been marked as a duplicate of this bug. ***
*** Bug 532876 has been marked as a duplicate of this bug. ***
*** Bug 532950 has been marked as a duplicate of this bug. ***
*** Bug 533068 has been marked as a duplicate of this bug. ***
*** Bug 533318 has been marked as a duplicate of this bug. ***
*** Bug 533577 has been marked as a duplicate of this bug. ***
*** Bug 533938 has been marked as a duplicate of this bug. ***
*** Bug 533707 has been marked as a duplicate of this bug. ***
*** Bug 534150 has been marked as a duplicate of this bug. ***
*** Bug 534575 has been marked as a duplicate of this bug. ***
*** Bug 534739 has been marked as a duplicate of this bug. ***
*** Bug 534740 has been marked as a duplicate of this bug. ***
*** Bug 534741 has been marked as a duplicate of this bug. ***
*** Bug 534742 has been marked as a duplicate of this bug. ***
*** Bug 534829 has been marked as a duplicate of this bug. ***
*** Bug 534982 has been marked as a duplicate of this bug. ***
*** Bug 534964 has been marked as a duplicate of this bug. ***
*** Bug 534925 has been marked as a duplicate of this bug. ***
*** Bug 534920 has been marked as a duplicate of this bug. ***
*** Bug 534918 has been marked as a duplicate of this bug. ***
The cure introduced in r7608 is worse than the disease. Now the defaults are always taken from the build directory, not the installation directory. It does not even start up anymore: (glchess:12668): libglade-WARNING **: could not find glade file '/scratch/build-area/gnome-games-2.22.2/glchess/glade/glchess.glade' Traceback (most recent call last):
+ Trace 198915
app = main.Application()
self.ui = UI(self)
self.controller = gtkui.GtkUI(self)
self._gui = loadGladeFile('glchess.glade')
return gtk.glade.XML(os.path.join(GLADE_DIR, name), root, domain = DOMAIN)
Actually, there is no reason at all to reference the build directory in the installed files, especially in so fragile code paths.
I don't know jack diddly about Python but my first guess is that we don't have a good sys.path and any attempt to import 'main' would, in the bug filer's example be like trying to import: /var/lib/python-support/python2.5/main.py So it seems to me that we should be using globally unique qualifiers for import like: import 'glchess/main' or do something really hackey like look at __FILE__ early and pull out where glchess.py is living on the filesystem and append that directory to the end of sys.path programatically. Then subsequent calls like 'import "main"' should work. But you guys are the Python people. What do you think?
'import main' in glchess.py will import main.py from the directory where glchess.py is located if it exists, before looking at other modules, so this is not where the problem lies. The real issue here is the 'installed_mode' hack in defaults.py which is useless and breaks as an unexpected consequence of the change. An installed version should entirely strip the references to the build paths anyway, not use some 'installed_version' property.
*** Bug 535202 has been marked as a duplicate of this bug. ***
*** Bug 535180 has been marked as a duplicate of this bug. ***
*** Bug 535177 has been marked as a duplicate of this bug. ***
*** Bug 535231 has been marked as a duplicate of this bug. ***
I'll generate a patch this morning.
I found this snippet of code in deskbar-applet; from their Makefile.am, it appears that they once had this same problem and resolved it by doing the following instead: def check_deskbar_path (): root_dir = dirname(dirname(__file__)) if exists(join(root_dir, "Makefile.am")): # Running in uninstalled mode sys.path.insert(0, abspath(root_dir)) logging.info ("Running uninstalled, adding %s to system path" % abspath(root_dir)) Looks hackey but sane. With this, we can kill off the installed_mode variable and just figure out where we are at runtime.
Created attachment 111769 [details] [review] kill off installed_mode, fix sys.path, don't include absbuilddir This fixes this bug and I have committed it to the stable branch. Think this is worth a re-spin of 2.22.2? From the number of duplicates, I'd say yes. Robert, can you audit my work and confirm that this is sane? If so, can you apply the patch and commit to trunk? Joss, what are your thoughs? (Thanks for the help, BTW) Leaving bug open until committed to trunk.
Looks good. We definitely need a respin. I've committed to the trunk.
Respinning.
*** Bug 535810 has been marked as a duplicate of this bug. ***
*** Bug 535984 has been marked as a duplicate of this bug. ***
*** Bug 535966 has been marked as a duplicate of this bug. ***
*** Bug 536128 has been marked as a duplicate of this bug. ***
*** Bug 536905 has been marked as a duplicate of this bug. ***
*** Bug 536918 has been marked as a duplicate of this bug. ***
*** Bug 536995 has been marked as a duplicate of this bug. ***
*** Bug 537268 has been marked as a duplicate of this bug. ***
*** Bug 537276 has been marked as a duplicate of this bug. ***
*** Bug 537321 has been marked as a duplicate of this bug. ***
*** Bug 537403 has been marked as a duplicate of this bug. ***
*** Bug 537402 has been marked as a duplicate of this bug. ***
*** Bug 537517 has been marked as a duplicate of this bug. ***
*** Bug 537903 has been marked as a duplicate of this bug. ***
*** Bug 537891 has been marked as a duplicate of this bug. ***
*** Bug 538131 has been marked as a duplicate of this bug. ***
*** Bug 538513 has been marked as a duplicate of this bug. ***
*** Bug 538758 has been marked as a duplicate of this bug. ***
Recent duplicates show this is _still_ occurring in 2.22.2.1
*** Bug 538930 has been marked as a duplicate of this bug. ***
*** Bug 539522 has been marked as a duplicate of this bug. ***
*** Bug 539219 has been marked as a duplicate of this bug. ***
Bug 538513 and Bug 538758 appear the have the information needed to resolve this. It's some kind of fuckery in Ubuntu. Why are they still packaging glChess separately?
The more I look at this the more I'm convinced this is a bug in python-support. I think that uninstalling glchess and installing gnome-games in the same transaction is not handled correctly by the python-support triggers in Ubuntu. Can someone on Ubuntu try opening up aptitude, going to gnome-games and doing a reinstall of gnome-games and gnome-games-data (press "L" to mark a package for reinstall). I'm willing to bet $5 that that fixes it. First person to test it gets credit in the next release. :)
I can confirm that removing glchess and installing gnome-games in one transaction causes the bug, and that reinstalling gnome-games & -data fixes the bug.
Yes, it did fix it :P
Created attachment 113233 [details] [review] Give the users a sane message about their installation being broken Give the users a sane message about their installation being broken instead of crashing in commit r7728, closing. Patch attached for distros and maybe stable branch.
Does running 'update-python-modules -p' fix the issue when it occurs? If so, that bug is http://bugs.debian.org/486516 as Jason suggested.
*** Bug 539673 has been marked as a duplicate of this bug. ***
*** Bug 539662 has been marked as a duplicate of this bug. ***
python-support 0.8.2 is out with a fix for distros.
Ubuntu's seb128 is uploading a copy of gnome-games-data that conflicts with glchess
*** Bug 540104 has been marked as a duplicate of this bug. ***
*** Bug 540550 has been marked as a duplicate of this bug. ***
*** Bug 540570 has been marked as a duplicate of this bug. ***
*** Bug 540602 has been marked as a duplicate of this bug. ***
*** Bug 540765 has been marked as a duplicate of this bug. ***
*** Bug 540813 has been marked as a duplicate of this bug. ***
*** Bug 540847 has been marked as a duplicate of this bug. ***
*** Bug 540936 has been marked as a duplicate of this bug. ***
*** Bug 540984 has been marked as a duplicate of this bug. ***
*** Bug 542489 has been marked as a duplicate of this bug. ***
Removing people from this bug to stop duplicate reports being received. Please re-attach if you are still interested.
*** Bug 543182 has been marked as a duplicate of this bug. ***
*** Bug 542809 has been marked as a duplicate of this bug. ***
*** Bug 543508 has been marked as a duplicate of this bug. ***
*** Bug 543507 has been marked as a duplicate of this bug. ***
*** Bug 543506 has been marked as a duplicate of this bug. ***
*** Bug 543752 has been marked as a duplicate of this bug. ***
*** Bug 545013 has been marked as a duplicate of this bug. ***
*** Bug 545569 has been marked as a duplicate of this bug. ***
*** Bug 547796 has been marked as a duplicate of this bug. ***
*** Bug 547986 has been marked as a duplicate of this bug. ***
*** Bug 556806 has been marked as a duplicate of this bug. ***
*** Bug 557029 has been marked as a duplicate of this bug. ***
*** Bug 557654 has been marked as a duplicate of this bug. ***