[Tutor] 'import site' failed error
my.mailing.lists at noos.fr
Thu Aug 12 18:20:50 CEST 2004
I've drawn a blank trying to find how to get PyRun_SimpleFile to run
with the verbose option - I found someone mention it on a wishlist, so
perhaps it isn't possible yet.
So instead I'm just going to ignore it for the meanwhile, since the
program still seems to output correctly (the good ol' head-in-the-sand
technique). However, if anyone knows how I can sort it out, please let
> 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?
> Tutor maillist - Tutor at python.org
More information about the Tutor