Python simulations on Linux
When loading a python simulation in Breve 2.6 on Linux I get the following error:
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "lib/classes/breve/__init__.py", line 3, in ?
import sys, os, math, random, array
ImportError: No module named os
Looks like the python path isn't getting set properly.

It works for me without
It works for me without setting the path (using the command line version). Try this in breve's root dir:
$ ./bin/breve demos/Gatherers.py
If you're using the IDE version you can set the path by doing (never tried before):
$ export PYTHONPATH='path_to_breve/lib/classes/'
Cesar
Hi, just downloaded
Hi, just downloaded breve_IDE on Gentoo Linux.
I have the same problem of the OP.
.tz demos work out of the box. .py demos refuse to start. The log viewer tells me:
Error at line 7 of "DLA.py":
syntax error in file "DLA.py" at line 7 near "breve"
See log window for details
(The log window actually replies the same error)
In the terminal where I launch breve, instead I see:
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "lib/classes/breve/__init__.py", line 3, in ?
import sys, os, math, random, array
ImportError: No module named os
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "lib/classes/breve/__init__.py", line 3, in ?
import sys, os, math, random, array
ImportError: No module named os
Any hint?
Way I got it to work
Assuming you have some version of python already installed on your system, just edit the breveIDE script and get rid of the lines which set the python path. This way it'll just use your default python implementation. There's probably a better solution, but it works.
BREVE - python sims don't work....
Hello
I'm trying to run python sim's on my ubuntu 7.10.
Steve simulations work just fine but python dont...
The error when i try to run a simulation is
Error at line 2 of "BraitenbergTemplate.py":
syntax error in file "BraitenbergTemplate.py" at line 2 near "breve"
See log window for details
I have already tried the solutions proposed here:
my breve script:
#!/bin/sh
#
# Apparently not all systems have the same version of Python,
# and no static version seems to be available. The breve
# distribution therefore includes a copy of the Python 2.4
# library.
#
DIRECTORY=`dirname $0`
export LD_LIBRARY_PATH=$DIRECTORY/lib:$LD_LIBRARY_PATH
export PYTHONHOME=$DIRECTORY/lib/classes
$DIRECTORY/breveIDE_ex $*
My phyton version is
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
I tried to define the path to the python home but it still downt work. I also tried using the dos2unix tool, cuz i tought that it could be a problem a file format(windows) but still didnt work
Any help would be very apreciated
Thanks
please post additional details
Thanks for the report.
Because of all the different Linux setups out there, the breveIDE for Linux has not gotten as much testing as it should have.
I'm interested in a couple of additional details from people who are having trouble:
- jon
python versions
I am running current Gentoo Linux x86; I have python 2.3 and 2.4 installed (fully working, I develop in Python and lots of additional libraries are installed and working)
As for the CLI and the exact python versions, I'll tell you when I come back home from work :)
Why does not breve use the system Python implementation?
The only reason breve comes
The only reason breve comes with its own Python implementation is (ironically) to ensure that it works right out of the box even if no Python installation is found on the system (as is generally the case for Windows).
- jon
I think that it can be
I think that it can be safely removed from the linux version as most distros (if not all) comes with Python installed (but perhaps this is not a good idea since some path variables must be set before running breve).
Cesar
does not make that much sense
My 0.02€: If a user has interest in breve, most probably he/she will be talented enough to install Python by himself. It's not that hard as a dependence.
MacOS X and Linux have python installed 99.9% of the times.
I would keep the included Python just in case, maybe as a "breve_staticpython" or something like that, but tell people using UNIX-like systems to try using the system python implementation first.
Anyway: I have python 2.3.5 and 2.4.4 installed. It seems that by commenting the ./breve_IDE script as before, it works :)
got it working in fedora 8 by blanking out environment
I got breveIDE 2.6 working on my fedora 8 system by launching a shell with a very sparse environment like this.
exec env -i HOME=$HOME TERM=$TERM DISPLAY=:0 /bin/bash -c ./breveIDE
this seems to let breve use the python environment that is provided and python now works without errors for me.
Skryking
python on windows
Hi, I also get an error, but on windows.
C:\breve_windows_2.6\breve_2.6>bin\breve demos\Braitenberg\Aggressor.py
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "lib/classes\breve\__init__.py", line 3, in ?
import sys, os, math, random, array
ImportError: No module named os
Failed to initialize Python frontend. breve will not be able to execute Python
files.
Parse Error: parse error in file "demos\Braitenberg\Aggressor.py" at line 7 near
"breve" at line 7 of file "demos\Braitenberg\Aggressor.py"
I run the command line version of breve on windows. I have python already installed. I tried setting PYTHONPATH to C:\breve_windows_2.6\breve_2.6\lib\classes\python2.3 and I also tried setting it to
C:\breve_windows_2.6\breve_2.6\lib\classes
The IDE version *does* work. But this CLI version does not.
Any ideas?
Thanks,
Jonathan