[sage-support] Re: Getting __name__ (or similar) of load-ed script?

2013-06-10 Thread Volker Braun
The load() and attach()ed files should obviously be treated the same (except for the reloading part), and offer a unified interface. Right now that is IMHO a lot of spaghetti code that grew over the years. The fact that even simple patches don't get reviewed (http://trac.sagemath.org/14523) did

[sage-support] Re: Getting __name__ (or similar) of load-ed script?

2013-06-09 Thread leif
Emil wrote: Thanks Leif. inspect.getfile() doesn't seem to do what I want. The situation is that I have a number of scripts, s1.sage, s2.sage, etc, and I'd like them to be able to write to a '.js' file with the same name as their filenames, e.g. s3.sage would write to s3.js, etc. I thought I mig

Re: [sage-support] Re: Getting __name__ (or similar) of load-ed script?

2013-06-09 Thread Emil
Thanks Leif. inspect.getfile() doesn't seem to do what I want. The situation is that I have a number of scripts, s1.sage, s2.sage, etc, and I'd like them to be able to write to a '.js' file with the same name as their filenames, e.g. s3.sage would write to s3.js, etc. I thought I might be able to

[sage-support] Re: Getting __name__ (or similar) of load-ed script?

2013-06-09 Thread leif
leif wrote: Emil wrote: I'd like to know if it's possible to get the filename of a script that's been run using the "load" or "attach" command at the sage: prompt. If I insert a "print __name__" in the script I just get "__main__". I know __name__ isn't the right thing, since I'm not dealing w

[sage-support] Re: Getting __name__ (or similar) of load-ed script?

2013-06-09 Thread leif
Emil wrote: I'd like to know if it's possible to get the filename of a script that's been run using the "load" or "attach" command at the sage: prompt. If I insert a "print __name__" in the script I just get "__main__". I know __name__ isn't the right thing, since I'm not dealing with an import