On 7/12/2009 11:13 AM Stef Mientki said...
SM> if __name__ == '__main__':
SM>import db_test
SM>new_globals = {}
SM>new_globals [ '__name__' ] = '__main__'
SM>new_globals [ '__file__' ] = 'not really valuable'
SM>execfile ( 'db_test.py', new_globals )
Why not:
implie
In article ,
Stef Mientki wrote:
>Stef deleted an attribution:
>>
>> Why not:
>>
>> import db_test
>> db_test.main()
>
>Yes I tried that too, but it gives the following error: "module object
>not callable"
You need to create a main() function in db_test first.
--
Aahz (a...@pythoncraft.com)
SM> if __name__ == '__main__':
SM>import db_test
SM>new_globals = {}
SM>new_globals [ '__name__' ] = '__main__'
SM>new_globals [ '__file__' ] = 'not really valuable'
SM>execfile ( 'db_test.py', new_globals )
Why not:
import db_test
db_test.main()
I think that is what
> Stef Mientki (SM) wrote:
>SM> Stef Mientki wrote:
>>> hello,
>>>
>>> when I''m working in a library,
>>> and want to test some of the library functions,
>>> I need to switch to a main application,
>>> (which has a normal main-section)
>>> and run that.
>>>
>>> If the library is simply,
>
In article ,
Stef Mientki wrote:
>
>when I''m working in a library, and want to test some of the library
>functions, I need to switch to a main application, (which has a normal
>main-section) and run that.
if __name__ == '__main__':
main()
Then you can call main() from another module for te
Stef Mientki wrote:
hello,
when I''m working in a library,
and want to test some of the library functions,
I need to switch to a main application,
(which has a normal main-section)
and run that.
If the library is simply,
I add a main section to the library,
so no problem.
But if the library r