Re: [Tutor] identifying the calling module/function

2008-03-10 Thread tetsuo2k6
Kent Johnson schrieb: > [EMAIL PROTECTED] wrote: > >> in dgf.py: (hope the formatting gets good for you, t-bird breaks the >> lines badly on my machine...) >> >> def csvwriter(*column_definitions): >> """Edit Me!""" >> if sys.argv[0] == /usr/local/bin/xyz.py: >> output_c

Re: [Tutor] identifying the calling module/function

2008-03-08 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > in dgf.py: (hope the formatting gets good for you, t-bird breaks the > lines badly on my machine...) > > def csvwriter(*column_definitions): > """Edit Me!""" > if sys.argv[0] == /usr/local/bin/xyz.py: > output_csv_filename = "xyz.csv" >

Re: [Tutor] identifying the calling module/function

2008-03-08 Thread tetsuo2k6
Jeff Younker schrieb: > > Telling us your goal might allow us to recommend a better > and faster way of accomplishing it. > > - Jeff Younker - [EMAIL PROTECTED] - > > > in dgf.py: (hope the formatting gets good for you, t-bird breaks the lines badly on my machine...) def csvwriter(*column_d

Re: [Tutor] identifying the calling module/function

2008-03-07 Thread Jeff Younker
On Mar 7, 2008, at 6:04 AM, [EMAIL PROTECTED] wrote: > Kent Johnson schrieb: >> >> Why do you need to do this? It sounds like a design change is needed. >> Anyway the answer to your question is yes. This recipe should point >> you >> in the right direction: >> http://aspn.activestate.com/ASPN/Co

Re: [Tutor] identifying the calling module/function

2008-03-07 Thread Andreas Kostyrka
There are basically a number of things you might want: 1.) sys.argv[0] 2.) __main__.__file__ 3.) sys._getframe The first two will tell which script is the main program. The last one will tell you which function has called you. But as Kent has pointed out, this is rarely a good idea. Actually, it

Re: [Tutor] identifying the calling module/function

2008-03-07 Thread tetsuo2k6
Kent Johnson schrieb: > [EMAIL PROTECTED] wrote: >> Hello Tutor! >> >> I am building a couple of scripts to manage a database for our >> company. The projects name is 'dgf'. As a lot of the functionality is >> used in more than one of these scripts, I moved this functionality to >> a module (dgf

Re: [Tutor] identifying the calling module/function

2008-03-07 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hello Tutor! > > I am building a couple of scripts to manage a database for our company. > The projects name is 'dgf'. As a lot of the functionality is used in > more than one of these scripts, I moved this functionality to a module > (dgf.py). It has several function

[Tutor] identifying the calling module/function

2008-03-07 Thread tetsuo2k6
Hello Tutor! I am building a couple of scripts to manage a database for our company. The projects name is 'dgf'. As a lot of the functionality is used in more than one of these scripts, I moved this functionality to a module (dgf.py). It has several functions now. Question: Is there an easy wa