Problem running python program?

John Machin machin_john_888 at hotmail.com
Tue Jun 19 00:28:54 EDT 2001


Timothy Reaves <treaves at silverfields.com> wrote in message news:<mailman.992884796.5697.python-list at python.org>...
> When I run a couple different programs, the following is what happens. 
> Do I have python setup incorrectly?

Definitely. See below.
> 
> [treaves at double treaves]$ export PYTHONHOME=/usr/lib/python2.1/
> [treaves at double treaves]$ gnucash
> Could not find platform independent libraries <prefix>
> Could not find platform dependent libraries <exec_prefix>
> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
> 'import exceptions' failed; use -v for traceback
> Warning!  Falling back to string-based exceptions
> 'import site' failed; use -v for traceback
> Fatal Python error: couldn't import os
> Aborted (core dumped)
[second example snipped]

My guess is that you have a Python binary without a whole lot of
supporting *.py files. Also [based on 'import exceptions' failed] you
are running an old Python [exceptions module was in exceptions.py, is
now built into the base executable]. Maybe your PYTHONHOME is wrong
(but PYTHONHOME is an *alternate* directory!?) or the files have
vanished.

Instead of running gnucash etc, try just

   python -v 

The problem may be in your gnucash etc scripts; this will help isolate
the problem. If the problem is more widespread, the messages that come
out might help diagnose the problem.

This is something like what you should see from a succesful python -v 
(produced on a Windows machine).
8<=================================================
# C:\PYTHON21\lib\site.pyc matches C:\PYTHON21\lib\site.py
import site # precompiled from C:\PYTHON21\lib\site.pyc
# C:\PYTHON21\lib\os.pyc matches C:\PYTHON21\lib\os.py
import os # precompiled from C:\PYTHON21\lib\os.pyc
import nt # builtin
# C:\PYTHON21\lib\ntpath.pyc matches C:\PYTHON21\lib\ntpath.py
import ntpath # precompiled from C:\PYTHON21\lib\ntpath.pyc
# C:\PYTHON21\lib\stat.pyc matches C:\PYTHON21\lib\stat.py
import stat # precompiled from C:\PYTHON21\lib\stat.pyc
# C:\PYTHON21\lib\UserDict.pyc matches C:\PYTHON21\lib\UserDict.py
import UserDict # precompiled from C:\PYTHON21\lib\UserDict.pyc
Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>>
8<================================================

You will note that the version info is printed *AFTER* the
(successful) importing of various modules -- if you get failed import
messages and it aborts without telling you the version, try python -V

Sorry I can't help you more:
(a) you need to say what Python version, how you built/installed it,
which platform you are on ...
(b) I know little about Python on Unix.
Hopefully once you have remedied (a) and the time-zones are
favourable, you will get more & better help from others.

Cheers,
John



More information about the Python-list mailing list