On 10/26/06, William Stein <[EMAIL PROTECTED]> wrote:

> Do you have any examples where this happens.  Whenever I try to use
> inspect.getsource on a binary file, I get
>
> <type 'exceptions.TypeError'>: arg is not a module, class, method,
> function, traceback, frame, or code object
>
> Maybe this problem you had was only with Python << 2.5?

No, it happens with both 2.4 and 2.5.  This is what I get if I disable
the binary_file check, after typing 'import strop' and 'strop??':

Type:           module
Base Class:     <type 'module'>
String Form:    <module 'strop' from
'/usr/local/stow/python2.5/lib/python2.5/lib-dynload/strop.so'>
Namespace:      Interactive
File:           /usr/local/stow/python2.5/lib/python2.5/lib-dynload/strop.so
Source:
[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@<D0>[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@^@<B8><B0>[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@4^@
[EMAIL PROTECTED]@([EMAIL PROTECTED]@ [EMAIL PROTECTED]@[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@<C0>[EMAIL PROTECTED]@<C0>[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@
^@<C0>[EMAIL PROTECTED]@<C0>[EMAIL PROTECTED]

[more binary junk]

> Perhaps you could put the "if not binary_file" in your inspect_getsource
> instead?

I'll be happy to do that, but then the call api for the modified
getsource would become:

def inspect_getsource(x,binary_file)

Since I'd be calling it as

inspect_getsource(foo,binary_file)

your modified one would have to match this API so it doesn't fire an error.

And if I do this, would your SAGE setup work OK?  I'm happy to
implement that approach, as long as it does solve what you need
without reintroducing the 'binary junk' problem to end users.

Cheers,

f

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to