🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

embeb python 2.3

Started by
1 comment, last by athos_musketeer 20 years, 10 months ago
i have a c++ program that embebs python 2.3 in windows. when i execute this program in other machines the follow message appears in the console: ''import site'' failed use -v for tracebak anyone knows what is this about? because all the scripts work perfectly.(i think) thanks.
Advertisement
well, ''import'' is used to import a module, and if you move the code to another machine without moving the ''site'' module, you would run into that error I suppose. Try searching for ''site.py'' or ''site.pyc'' on your development (''main'') computer and copy that to the same location on the other machines.

Chris Pergrossi
My Realm | "Good Morning, Dave"
Chris PergrossiMy Realm | "Good Morning, Dave"
Also make sure site.py (or .pyc, or .pyd) is in sys.path. Do this in your static extension module OR in every source file:
import syssys.path.append(''./relative/path/to/scripts'') 


Also it may help to use pdb. In each script import pdb and then encase the entire script in try/except. If an unhandled exception occurs call pdb.pm() (prints a traceback and gives you python debugger prompt if stdin is available without crashing your embedded app)

This topic is closed to new replies.

Advertisement