Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85527

Re: function inclusion problem

References <d7871507-2677-4fef-9462-d429217e7ad3@googlegroups.com> <lac@openend.se> <201502110006.t1B060VZ021974@fido.openend.se> <201502110016.t1B0GVah024279@fido.openend.se>
Date 2015-02-11 08:27 -0500
Subject Re: function inclusion problem
From Victor L <vlyamtsev@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.18654.1423661250.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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@openend.se> wrote:

> In a message of Wed, 11 Feb 2015 01:06:00 +0100, Laura Creighton writes:
> >In a message of Tue, 10 Feb 2015 15:38:02 -0800, vlyamtsev@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
>
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

function inclusion problem vlyamtsev@gmail.com - 2015-02-10 15:38 -0800
  Re: function inclusion problem sohcahtoa82@gmail.com - 2015-02-10 15:55 -0800
  Re: function inclusion problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-11 10:57 +1100
  Re: function inclusion problem Michael Torrie <torriem@gmail.com> - 2015-02-10 17:00 -0700
  Re: function inclusion problem sohcahtoa82@gmail.com - 2015-02-10 16:02 -0800
  Re: function inclusion problem Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-10 17:02 -0700
  Re: function inclusion problem Laura Creighton <lac@openend.se> - 2015-02-11 01:06 +0100
  Re: function inclusion problem Laura Creighton <lac@openend.se> - 2015-02-11 01:16 +0100
  Re: function inclusion problem Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-02-10 20:52 -0500
  Re: function inclusion problem Victor L <vlyamtsev@gmail.com> - 2015-02-11 08:27 -0500
  Re: function inclusion problem Dave Angel <d@davea.name> - 2015-02-11 10:07 -0500
  Re: function inclusion problem Tim Chase <python.list@tim.thechases.com> - 2015-02-11 09:22 -0600
  Re: function inclusion problem Chris Angelico <rosuav@gmail.com> - 2015-02-12 02:37 +1100
  Re: function inclusion problem blue <catalinfest@gmail.com> - 2015-02-27 12:11 -0800

csiph-web