master2be1 / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

pychess fails to run #364

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to investigate a pycairo bug which causes pychess to crash
http://bugs.freedesktop.org/show_bug.cgi?id=19287
so I installed pychess to reproduce the problem.

What steps will reproduce the problem?
1. pychess

What is the expected output?
A running pychess program.

What do you see instead?
$ pychess
Traceback (most recent call last):
  File "/a/bin/pychess", line 23, in <module>
    if isInstalled():
  File "/a/lib/python2.6/site-packages/pychess/System/prefix.py", line 35,
in isInstalled
    return _installed
NameError: global name '_installed' is not defined

Does it happen every time?
Yes

What version of the product are you using?
0.10

Did you use an installed version of PyChess or did you run in from a
tarball/svn?
installed version

Please provide any additional information below.
The pychess/System/prefix.py makes assumptions about where a user will
install their software. If the user installs software to a directory which
is not hard-coded into prefix.py then pychess will not run.
I can work around the problem by adding "/a/share" to 'prefixes' but I
should not have to do this.

Please attach the latest pychess logfile.
For PyChess <= 0.6.x it's hidden in your homedirectory and called
".pychess.log".
For PyChess > 0.6.x, it's in a hidden folder, under your homedirectory,
named ".pychess/"
There is no logfile - pychess raised a NameError exception.

Original issue reported on code.google.com by steve872...@yahoo.com.au on 29 Dec 2008 at 12:25

GoogleCodeExporter commented 9 years ago
I see your point, that prefixes = ("/usr/share", "/usr/local/share",
"/usr/share/locale", "/usr/share/games", "/usr/local/share/games") might not be
enough for everyone. I do however not see a way to locate the directory of the
datafiles without iterating through a list of possible locations.

We could call 'locate pychess' on the entire system, but that would give us the
danger of wrong data being found.

Do you have a suggestion?

Original comment by lobais on 29 Dec 2008 at 12:43

GoogleCodeExporter commented 9 years ago
I think the solution is to ensure that setup.py and pychess are consistent and
write and read the data files from the same directory. Then you do not need to
search for data by iterating over possible data directories.
distutils setup() writes the data files to sys.prefix, so get pychess to read
the data files from sys.prefix too.

This modified code for prefix.py works on my system:

import sys
if "site-packages" in __file__:
    _prefix = join (sys.prefix, "share", "pychess")
    _installed = True
    if not isdir (_prefix):
    raise Exception("can't find pychess 'share' directory")
else:
    _prefix = abspath (join (dirname (__file__), "../../.."))
    _installed = False

The directories "/usr/share/games", "/usr/local/share/games" would not be 
detected.
But the current pychess setup.py does not install the data to these directories 
anyway.

Original comment by steve872...@yahoo.com.au on 29 Dec 2008 at 3:10

GoogleCodeExporter commented 9 years ago
You are right. Thx. for the patch, applied to trunk.

Original comment by gbtami on 1 Jan 2009 at 9:51