[python-win32] Problems embedding in C++
Ishank Jain
ishank_jain@hotmail.com
Tue, 16 Jul 2002 21:02:30 +0000
i noticed one thing. the embedded interpreter is failing to import
extensible modules only (with extension .pyd). it is successfully able to
run files with other modules (.py or .pyc).
does the embedded interprester runs in an sandboxed environment where it is
not allowed to access win32 extensions?
i couldn't find -v option for an embedded interpreter but thanks for that
info. i didnt knew that option.
-ishank
>From: "Jorgensen, Jens" <jjorgensen@Tallan.com>
>To: "Ishank Jain" <ishank_jain@hotmail.com>, <python-win32@python.org>
>Subject: RE: [python-win32] Problems embedding in C++
>Date: Tue, 16 Jul 2002 16:45:57 -0400
>
>Hmmm. That's pretty tough. The path certainly looks ok. The command-line
>python has the '-v' param which I've found to be helpful for debugging
>module loading. Perhaps there is an equivalent in the embedded api?
>
> -----Original Message-----
> From: Ishank Jain [mailto:ishank_jain@hotmail.com]
> Sent: Tue 7/16/2002 2:24 PM
> To: Jorgensen, Jens; python-win32@python.org
> Cc:
> Subject: RE: [python-win32] Problems embedding in C++
>
>
>
> i called the following file:
>
> import sys
> try :
> import win32com
> except Exception, e:
> print sys.path
> print e
>
> i got the following output:
>
> ['c:\\python22', 'c:\\python22\\include', 'c:\\python22\\libs',
> 'c:\\python22\\d
> lls', 'c:\\python22\\lib', 'c:\\python22\\lib\\site-packages',
> 'c:\\python22\\li
> b\\site-packages\\win32', 'c:\\python22\\lib\\site-packages\\win32com',
> 'c:\\pyt
> hon22\\lib\\site-packages\\win32comext',
> 'C:\\Python22\\lib\\site-packages\\Pyth
> onwin', 'C:\\Python22\\lib\\site-packages\\win32\\lib',
> 'C:\\Python22\\Lib\\lib-
> tk', 'D:\\Dev\\PythonScriptWrapper\\Debug']
> No module named win32api
> [3514 refs]
>
> so the exception did occur but as you can see the sys.path includes the
> win32 path where win32api.pyd is stored. so ideally it should be able to
> find the file.
>
> -ishank
>
>
> >From: "Jorgensen, Jens" <jjorgensen@Tallan.com>
> >To: "Ishank Jain" <ishank_jain@hotmail.com>, <python-win32@python.org>
> >Subject: RE: [python-win32] Problems embedding in C++
> >Date: Tue, 16 Jul 2002 15:06:05 -0400
> >
> >I wonder if the win32com module is somehow screwing with the path. Did
>you
> >try:
> >
> >import sys.path
> >try :
> > import win32com
> >except Exception, e :
> > print sys.path
> >
> >
> >
> > -----Original Message-----
> > From: Ishank Jain [mailto:ishank_jain@hotmail.com]
> > Sent: Tue 7/16/2002 1:29 PM
> > To: Jorgensen, Jens; python-win32@python.org
> > Cc:
> > Subject: RE: [python-win32] Problems embedding in C++
> >
> >
> >
> > yes, thats how i checked the sys.path
> >
> >
> > >From: "Jorgensen, Jens" <jjorgensen@Tallan.com>
> > >To: "Ishank Jain" <ishank_jain@hotmail.com>,
><python-win32@python.org>
> > >Subject: RE: [python-win32] Problems embedding in C++
> > >Date: Tue, 16 Jul 2002 14:24:03 -0400
> > >
> > >How did you check sys.path? Did you use PyRun_SimpleFile to run
>the
> >script:
> > >
> > >import sys
> > >print sys.path
> > >
> > >?
> > >
> > > -----Original Message-----
> > > From: Ishank Jain [mailto:ishank_jain@hotmail.com]
> > > Sent: Tue 7/16/2002 12:46 PM
> > > To: python-win32@python.org
> > > Cc:
> > > Subject: [python-win32] Problems embedding in C++
> > >
> > >
> > >
> > > Hi,
> > >
> > > I have been trying to run a simple python file from C++
>using the
> > > PyRun_SimpleFile C api call.
> > >
> > > Let the file I need to run be demo.py.
> > > If the demo.py contains simple python commands such as:
> > >
> > > print "Hello World"
> > >
> > > my program works fine. But when i try to use something
>like:
> > >
> > > import win32com
> > > print "Hello World"
> > >
> > > it gives me an error saying that it cannot find the
>win32api
> >module. i
> > > checked the sys.path and it has the required path entries.
> > >
> > > also if i run the demo.py file using the python win gui
>then it
> >runs
> > > correctly. only when i run the file using the
>PyRun_SimpleFile
> >call, it
> > > fails.
> > >
> > > here is the traceback of the error:
> > > -----------------------------
> > > Traceback (most recent call last):
> > > File "..\hello.py", line 15, in ?
> > > import win32com
> > > File
>"C:\Python22\lib\site-packages\win32com\__init__.py", line
> >5, in ?
> > > import win32api, sys
> > > ImportError: No module named win32api
> > > [3929 refs]
> > > -----------------------------
> > >
> > > any help would be appreciated.
> > >
> > > Ishank Jain
> > > -----------------------------------------------
> > > Graduate Student
> > > Computer Engeering
> > > University of Minnesota, Twin Cities
> > > Voice: (Res) 612-331-9696 (Off) 612-626-0276
> > > Email: ishank_jain@hotmail.com
> > > -----------------------------------------------
> > >
> > >
>_________________________________________________________________
> > > Send and receive Hotmail on your mobile device:
> >http://mobile.msn.com
> > >
> > >
> > >
> > > _______________________________________________
> > > Python-win32 mailing list
> > > Python-win32@python.org
> > > http://mail.python.org/mailman/listinfo/python-win32
> > >
> > >
> >
> >
> > Ishank Jain
> > -----------------------------------------------
> > Graduate Student
> > Computer Engeering
> > University of Minnesota, Twin Cities
> > Voice: (Res) 612-331-9696 (Off) 612-626-0276
> > Email: ishank_jain@hotmail.com
> > -----------------------------------------------
> >
> > _________________________________________________________________
> > Join the world’s largest e-mail service with MSN Hotmail.
> > http://www.hotmail.com
> >
> >
> >
>
>
> Ishank Jain
> -----------------------------------------------
> Graduate Student
> Computer Engeering
> University of Minnesota, Twin Cities
> Voice: (Res) 612-331-9696 (Off) 612-626-0276
> Email: ishank_jain@hotmail.com
> -----------------------------------------------
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
>
Ishank Jain
-----------------------------------------------
Graduate Student
Computer Engeering
University of Minnesota, Twin Cities
Voice: (Res) 612-331-9696 (Off) 612-626-0276
Email: ishank_jain@hotmail.com
-----------------------------------------------
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com