Package: castle-combat
Version: 0.8.1.dfsg.1-3
Severity: important
Tags: patch

Hi,

In /usr/games/castle-combat it says:

import sys
sys.path.append('/usr/share/games/castle-combat/scripts')

Unfortunately, other packages or the system administrator or even the user might
have added other directories to the path before, in my case this was done by the
python-openturns package. Then, the 'import main' (or another import, in my case
the 'import common' in /usr/share/games/castle-combat/scripts/main.py) will not
import castle-combat's 'common.py', but some other. A bullet-proof way to add
private modules is to use

sys.path.insert(0, '/usr/share/games/castle-combat/scripts')

instead of

sys.path.append('/usr/share/games/castle-combat/scripts')

Like this, the castle-combat private module directory will always be searched 
first and there is no problem anymore.

At the moment the bug triggers if python-openturns is installed on the same
system as castle-combat. In this case, castle-combat will not start up:

$ castle-combat 
Castle-Combat requires pygame and twisted. If the game doesn't start up 
correctly, please verify that these are installed.
Traceback (most recent call last):
  File "/usr/games/castle-combat", line 8, in <module>
    main.main()
  File "/usr/share/games/castle-combat/scripts/main.py", line 33, in main
    init()
  File "/usr/share/games/castle-combat/scripts/main.py", line 7, in init
    common.init()
AttributeError: 'module' object has no attribute 'init'


Changing the sys.path line like suggested above fixes the bug.

Cheers,

Mika

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing-proposed-updates
  APT policy: (650, 'testing-proposed-updates'), (650, 'testing'), (450, 
'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages castle-combat depends on:
ii  python                 2.6.6-3+squeeze2  interactive high-level object-orie
ii  python-central         0.6.16+nmu1       register and build utility for Pyt
ii  python-numpy           1:1.4.1-5         Numerical Python adds a fast array
ii  python-pygame          1.8.1release-2+b1 SDL bindings for games development
ii  python-twisted         10.1.0-3          Event-based framework for internet
ii  ttf-dejavu-core        2.31-1            Vera font family derivate with add

castle-combat recommends no packages.

castle-combat suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to