Getting a module's byte code, how?

Irmen de Jong irmen.NOSPAM at xs4all.nl
Wed Feb 2 18:23:08 EST 2005


Steve Holden wrote:

>> But I also want the bytecode of modules that don't have a .pyc file,
>> possibly because they have already been 'dynamically' loaded from
>> another bytecode string ;-)
>>
> Aah, right, I suspect in these cases (which *are* pretty far from the 
> ordinary run of things) you'd sometimes be up the creek without a paddle.

I was afraid of that.
The whole mobile code stuff in Pyro is very powerful, for the
cases where it works and makes sense, I think.
However it is also fairly messy.
In the end perhaps it introduces more problems than it solves,
but its really nice to see it work for the simple cases :)


>> I want them! :-)
>>
> Well I'm afraid there's no guarantee that they haven't already been 
> garbage collected, and stamping your foot isn't going to do any good :-)

Heh, that was funny :D

> A pleasure. Thanks for Pyro! (and thanks for reminding me indirectly 
> that I need to guard that execution of hte module's code against 
> exceptions).

Pyro happily throws these exceptions in your face.
Like I said, rather messy.

--Irmen



More information about the Python-list mailing list