[Tutor] 'import site' failed error
my.mailing.lists at noos.fr
Thu Aug 12 13:11:29 CEST 2004
Hi Kent, that was a quick reply!
I've embedded the interpreter in a C app, and so the python file is
called using PyRun_SimpleFile(fp, "demo2.py");
so, I'm not too sure how to put the -v option in there (I'm doing some
websearching on it now).
I tried a simple python file like print "hello", but it didn't come up
with the import site error, so I guess it's more to do with the
embedding or my module thingy?
Kent Johnson wrote:
> I guess it is referring to the -v (verbose) option that you can pass
> to python when you start it up:
> D:\Projects>python -v
> # installing zipimport hook
> import zipimport # builtin
> # installed zipimport hook
> # C:\Python23\lib\site.pyc matches C:\Python23\lib\site.py
> import site # precompiled from C:\Python23\lib\site.pyc
> # C:\Python23\lib\os.pyc matches C:\Python23\lib\os.py
> import os # precompiled from C:\Python23\lib\os.pyc
> traceback is the stack trace. So this may give you more specific
> information about the location and type of failure. Give it a try and
> let us know what it says!
> At 12:29 PM 8/12/2004 +0200, nik wrote:
>> I've compiled the example in the Extending and Embedding tutorial
>> section 2.1 (creating an module with a couple of string objects), and
>> I get the error
>> 'import site' failed; use -v for traceback
>> even though the correct output is then printed to the screen.
>> What does this mean?
>> Do I need to post my code here (I've made a few modifications)?
>> How do I do the -v for traceback, and would it be useful to me?
More information about the Tutor