[Tutor] Re: [Turor] text editor problems

wheelege wheelege@tsn.cc
Sun, 21 Jan 2001 16:49:05 +1100


This is a multi-part message in MIME format.

------=_NextPart_000_00D0_01C083CA.110BEAC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


  Hi,

  I'm pretty sure that you need to pass those variables in as arguments =
to
the function save().

  Like..

def save(sname, oname)
  # code

and when you call it...

save(sname, oname) # pass the variables sname and oname

  I'm still a newbie so don't flame me if it doesn't turn out...

  Glen.

----- Original Message -----
From: Matthias Hager <martok@mattsmail.com>
To: <tutor@python.org>
Sent: Sunday, January 21, 2001 10:45 AM
Subject: [Tutor] text editor problems


> That's what I thought(just see if those variables are there), I =
have(kind
of, just reworded for less space)
>
> def save():
>   if sname:
>     open sname and write to it
>   elif oname:
>     open oname and write to it
>   else:
>     saveas()
>
> def saveas():
>   sname =3D asksaveasfile
>   blah blah
>
> def open():
>   oname =3D askopenfile
>   blahblah
>
> Then it gives me the error: No variable named sname exists.
>
> I know you guys gotta be getting sick of me, but what am I doing =
wrong?
> I can't figure it out, and I've tried changing it to:
> if oname !=3D "":
> elif sname !=3D "":
>
> All kinds of stuff, but I'm still getting an error.
>
> Any help is appreciated
>
> Matthias
>
>
>
>
> --
> Programming isn't cool, it's awesome.
>
> %%%################?????????###################^^^
>
>           martok@mattsmail.com
>       http://mymymatthias.tripod.com/
>
> %%%################????????####################^^^
>
>
> --
>
>
>
> Like my email address? Get your own for FREE at http://firstname.com
> Get you@JohnsMail.com or you@AlexsMail.com or pick from 500 more!
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor


------=_NextPart_000_00D0_01C083CA.110BEAC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><BR>&nbsp; Hi,<BR><BR>&nbsp; I'm pretty sure that you need to pass =
those=20
variables in as arguments to<BR>the function save().<BR><BR>&nbsp;=20
Like..<BR><BR>def save(sname, oname)<BR>&nbsp; # code<BR><BR>and when =
you call=20
it...<BR><BR>save(sname, oname) # pass the variables sname and=20
oname<BR><BR>&nbsp; I'm still a newbie so don't flame me if it doesn't =
turn=20
out...<BR><BR>&nbsp; Glen.<BR><BR>----- Original Message -----<BR>From: =
Matthias=20
Hager &lt;<A=20
href=3D"mailto:martok@mattsmail.com">martok@mattsmail.com</A>&gt;<BR>To: =
&lt;<A=20
href=3D"mailto:tutor@python.org">tutor@python.org</A>&gt;<BR>Sent: =
Sunday, January=20
21, 2001 10:45 AM<BR>Subject: [Tutor] text editor =
problems<BR><BR><BR>&gt;=20
That's what I thought(just see if those variables are there), I =
have(kind<BR>of,=20
just reworded for less space)<BR>&gt;<BR>&gt; def =
save():<BR>&gt;&nbsp;&nbsp; if=20
sname:<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; open sname and write to=20
it<BR>&gt;&nbsp;&nbsp; elif oname:<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; open =
oname=20
and write to it<BR>&gt;&nbsp;&nbsp; =
else:<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
saveas()<BR>&gt;<BR>&gt; def saveas():<BR>&gt;&nbsp;&nbsp; sname =3D=20
asksaveasfile<BR>&gt;&nbsp;&nbsp; blah blah<BR>&gt;<BR>&gt; def=20
open():<BR>&gt;&nbsp;&nbsp; oname =3D askopenfile<BR>&gt;&nbsp;&nbsp;=20
blahblah<BR>&gt;<BR>&gt; Then it gives me the error: No variable named =
sname=20
exists.<BR>&gt;<BR>&gt; I know you guys gotta be getting sick of me, but =
what am=20
I doing wrong?<BR>&gt; I can't figure it out, and I've tried changing it =

to:<BR>&gt; if oname !=3D "":<BR>&gt; elif sname !=3D =
"":<BR>&gt;<BR>&gt; All kinds=20
of stuff, but I'm still getting an error.<BR>&gt;<BR>&gt; Any help is=20
appreciated<BR>&gt;<BR>&gt; =
Matthias<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt;=20
--<BR>&gt; Programming isn't cool, it's awesome.<BR>&gt;<BR>&gt;=20
%%%################?????????###################^^^<BR>&gt;<BR>&gt;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<A=20
href=3D"mailto:martok@mattsmail.com">martok@mattsmail.com</A><BR>&gt;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<A=20
href=3D"http://mymymatthias.tripod.com/">http://mymymatthias.tripod.com/<=
/A><BR>&gt;<BR>&gt;=20
%%%################????????####################^^^<BR>&gt;<BR>&gt;<BR>&gt=
;=20
--<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; Like my email address? Get your own =
for FREE=20
at <A href=3D"http://firstname.com">http://firstname.com</A><BR>&gt; Get =
<A=20
href=3D"mailto:you@JohnsMail.com">you@JohnsMail.com</A> or <A=20
href=3D"mailto:you@AlexsMail.com">you@AlexsMail.com</A> or pick from 500 =

more!<BR>&gt;<BR>&gt;<BR>&gt;=20
_______________________________________________<BR>&gt; Tutor =
maillist&nbsp;=20
-&nbsp; <A href=3D"mailto:Tutor@python.org">Tutor@python.org</A><BR>&gt; =
<A=20
href=3D"http://mail.python.org/mailman/listinfo/tutor">http://mail.python=
.org/mailman/listinfo/tutor</A><BR></DIV></BODY></HTML>

------=_NextPart_000_00D0_01C083CA.110BEAC0--