function inclusion problem

Victor L vlyamtsev at gmail.com
Wed Feb 11 08:27:26 EST 2015


Laura, thanks for the answer - it works. Is there some equivalent of
"include" to expose every function in that script?
Thanks again,
-V
On Tue, Feb 10, 2015 at 7:16 PM, Laura Creighton <lac at openend.se> wrote:
> In a message of 2015年2月11日 01:06:00 +0100, Laura Creighton writes:
> >In a message of 2015年2月10日 15:38:02 -0800, vlyamtsev at gmail.com
> writes:
> >>I defined function Fatalln in "mydef.py" and it works fine if i call it
> from "mydef.py", but when i try to call it from "test.py" in the same
> folder:
> >>import mydef
> >>...
> >>Fatalln "my test"
> >>i have NameError: name 'Fatalln' is not defined
> >>I also tried include('mydef.py') with the same result...
> >>What is the right syntax?
> >>Thanks
> >>--
> >>https://mail.python.org/mailman/listinfo/python-list
> >
> >from mydef import Fatalln
> >
>> Also, please be warned. If you use a unix system, or a linux
> system. There are lots of problems you can get into if you
> expect something named 'test' to run your code. Because they
> already have one in their shell, and that one wins, and so ...
> well, test.py is safe. But if you rename it as a script and call
> it the binary file test ...
>> Bad and unexpected things happen.
>> Name it 'testme' or something like that. Never have that problem again.
> :)
>> Been there, done that!
> Laura
>>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150211/47cef679/attachment.html>


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /