Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > giving imp.load_module not a real file, HOW?

Reply
Thread Tools

giving imp.load_module not a real file, HOW?

 
 
Paul Sijben
Guest
Posts: n/a
 
      02-01-2008
I am running into a problem with the python interpreter's internals.

For some reason imp.load_module insists on getting a real open file as
the second parameter. I have not able to fool it with stringIO or
overloaded file objects.

So now I have two questions:
1) why does load_module insist on a real file
2) is there a way around it that does not involve (say) tempfile?

Paul
 
Reply With Quote
 
 
 
 
Christian Heimes
Guest
Posts: n/a
 
      02-01-2008
Paul Sijben wrote:
> For some reason imp.load_module insists on getting a real open file as
> the second parameter. I have not able to fool it with stringIO or
> overloaded file objects.
>
> So now I have two questions:
> 1) why does load_module insist on a real file
> 2) is there a way around it that does not involve (say) tempfile?


imp.load_module is implemented in C. The API expects a file object or a
file descriptor number. Internally the code creates a file pointer *FILE
from a file descriptor. You have to create a temporary file.

Christian

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The giving that keeps on giving sixteenmillion C Programming 0 11-19-2007 10:59 PM
Python not giving free memory back to the os get's me in real problems ... leuchte@gmail.com Python 17 04-26-2007 01:41 PM
OT: The Interview - Real, Funny...Real Funny The Rev [MCT] MCSE 42 05-31-2005 10:42 PM
call any usa REAL telephone number from the internet at pulver freeworld for .06 per minute - have your own real fone # for $10 month!! ucallvoip@yahoo.com VOIP 0 06-09-2004 01:41 AM
product of real and (integer)(after converted to real one) value - vhdl found fatal error senthil VHDL 5 01-24-2004 04:37 AM



Advertisments