[Fwd: Re: [Tutor] Syntax error]]

Roland Casselbrant roland.casselbrant@bonetmail.com
Wed Feb 19 08:20:02 2003


-------- Original Message --------
Subject: Re: [Fwd: Re: [Tutor] Syntax error]
Date: Wed, 19 Feb 2003 12:13:04 +0100
From: Roland Casselbrant <roland.casselbrant@bonetmail.com>
Reply-To: roland.casselbrant@bonetmail.com
To: Bob Gailer <ramrom@earthling.net>
References: <5.2.0.9.0.20030218201120.02f716e8@66.28.54.253>

Thanks a lot.

That really helped me out.
I guess being new to programming makes error like this easier to appear
without discovering.

Thanks for the tip about PythonWin. I=B4ll give it a try and se if it=B4s
good enough to abandon Crimson Editor as my multi purpose tool.

Thanks again.

Roland Casselbrant

Bob Gailer wrote:
 > These 2 lines have unbalanced parentheses:
 > efbh =3D ((uppvarm/graddar*24) * (20-(dut))
 > gradkorr =3D ((gradnorm/graddar)*uppvarm
 > Fix them and things should be OK.
 >
 > For future reference, its important to distinguish between compile
 > errors and execution errors. These are compile errors; they appeared
 > before any input was requested or output generated.
 >
 > The thing that makes it hard to find this kind of problem is that
 > there's an extra left parentheses which causes Python to expect more
 > lines that will eventually provide the closing parenthesis. When the
 > following line fails to do that, and the combination of the 2 lines is
 > in error, it reports the problem as having to do with the 2nd line.
 > Notice what happens when you enter the 2 lines interactively:
 >  >>> gradkorr =3D ((gradnorm/graddar)*uppvarm   ## extra left (
 > ... print stringJ, gradkorr                                 ## ... tel=
ls
 > you its waiting for more
 >   File "<stdin>", line 2
 >     print stringJ, gradkorr                                 ## print
 > following uppvarm is incorrect.
 >         ^
 > SyntaxError: invalid syntax
 >
 > So if the line reported looks OK, go back in the file and look at the
 > previous line(s). An IDE such as PythonWin is helpful here because it
 > highlights pairs of () [] {} "" '' etc. and makes it easy to spot extr=
a
 > delimiters.
 >
 > At 01:00 AM 2/19/2003 +0100, Roland Casselbrant wrote:
 >
 >> HEre is the complete code:
 >>
 >> hhe =3D 5000.0
 >> vvu =3D 5000.0
 >> stringA =3D 'Nettoenergibehovet: '
 >> stringB =3D 'Nettoenergibehov minus vattenuppvarmning: '
 >> stringC =3D 'Kompenserat for elpannans verkningsgrad: '
 >> stringD =3D 'Effektbehovet vid dimensionerande temperatur: '
 >> stringE =3D 'Till detta tillkommer arsmedeleffekt f=F6r
 >> varmvattenuppvarmning: '
 >> stringF =3D 'Dimensionerande effektbehov for flerbostadshuset i exemp=
let
 >> blir da: '
 >> stringZ =3D '                   '
 >> stringG =3D '   Effektbehov for eluppvarmt hus  '
 >> stringH =3D 'Program skrivet av Roland Casselbrant'
 >> stringI =3D '*************************************'
 >> stringJ =3D 'Efter gradkorrigering av varmebehovet har vi: '
 >> stringK =3D 'Ett normalar blir elanvandningen f=F6r smahuset i exempl=
et
 >> alltsa: '
 >>
 >>
 >> print stringZ
 >> print stringZ
 >> print stringG
 >> print stringH
 >> print stringI
 >> print stringZ
 >>
 >> totel =3D input("Total elaanvandning per ar: [kWh] ")
 >> pannverk =3D input("Elpannans armedelverkningsgrad: [%] ")
 >> totyta =3D input("Total uppvarmd bostadsyta: [m2] ")
 >> byggar =3D input("Byggar: ")
 >> graddar =3D input("Graddagar aktuellt ar: ")
 >> gradnorm =3D input("Graddagar normalar: ")
 >> dut =3D input ("Dimensionerande utetemperatur: [grader Celsius] ")
 >>
 >> # F=F6rst m=E5ste man r=E4kna bort den del av f=F6rbrukningen
 >> # som inte =E4r klimatberoende
 >> # d.v.s. hush=E5llsel och varmvattenuppv=E4rmning.
 >> # Vi r=E4knar h=E4r med 5000 kWh hush=E5llsel och 5000 kWh
 >> # f=F6r varmvattenuppv=E4rmning.
 >> # Uppv=E4rmningsbehovet blir d=E5:
 >>
 >> print stringA, totel
 >> print stringZ
 >>
 >> nettoel =3D totel-vvu-hhe
 >>
 >> print stringB, nettoel
 >> print stringZ
 >>
 >> # Nu =E4r inte hela denna energim=E4ngd "nyttig" utan vi m=E5ste komp=
ensera
 >> # f=F6r elpannans verkningsgrad. S=E5ledes =E4r nettoenergibehovet
 >> # f=F6r uppv=E4rmning:
 >>
 >> panna =3D pannverk/100.0
 >> uppvarm =3D nettoel*panna
 >>
 >> print stringC, uppvarm
 >> print stringZ
 >>
 >> # Effektbehovet vid dimensionerande temperatur l=F6ser vi ut
 >> # fr=E5n ekvationen:
 >>
 >> efbh =3D ((uppvarm/graddar*24) * (20-(dut))
 >>
 >> print stringD, efbh
 >> print stringZ
 >>
 >> # Till detta tillkommer =E5rsmedeleffekt f=F6r varmvattenuppv=E4rmnin=
g.
 >>
 >> mdff =3D (vvu/8760)
 >>
 >> print stringE, mdff
 >> print stringZ
 >>
 >> # Dimensionerande effektbehov f=F6r flerbostadshuset i exemplet blir =
d=E5:
 >>
 >> deff =3D efbh+mdff
 >>
 >> print stringF, deff
 >> print stringZ
 >>
 >> # Graddagskorrigering av v=E4rmebehovet g=E5r till s=E5 att man tar
 >> # kvoten av graddagarna
 >> # f=F6r normal=E5r och graddagarna f=F6r aktuell period och multiplic=
erar
 >> # med det
 >> # klimatberoende nettoenergibehovet f=F6r uppv=E4rmning enligt f=F6lj=
ande:
 >>
 >> gradkorr =3D ((gradnorm/graddar)*uppvarm
 >>
 >> print stringJ, gradkorr
 >> print stringZ
 >>
 >> # Ett normal=E5r blir elanv=E4ndningen f=F6r sm=E5huset i exemplet al=
lts=E5:
 >>
 >> totalel =3D ((gradkorr/panna)+(vvu+hhe))
 >>
 >> print stringK, totalel
 >> print stringZ
 >>
 >>
 >> EOF/roland.casselbrant@bonetmail.com
 >>
 >>
 >>
 >> -------- Original Message --------
 >> Subject: Re: [Tutor] Syntax error
 >> Date: Tue, 18 Feb 2003 16:06:45 -0700
 >> From: Bob Gailer <ramrom@earthling.net>
 >> To: roland.casselbrant@bonetmail.com, tutor@python.org
 >>
 >> At 10:48 PM 2/18/2003 +0100, Roland Casselbrant wrote:
 >> >The following lines is getting Syntax errors and I can=B4t understan=
d=20
why?
 >>
 >> Please copy the session and any associated program to the body of an
 >> e-mail
 >> so we can see exactly the sequence of operations and the error messag=
es.
 >>
 >> Bob Gailer
 >> mailto:ramrom@earthling.net
 >> 303 442 2625
 >>
 >>
 >> --
 >> Roland Casselbrant
 >>
 >>
 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 >>         Seen it all, done it all, can't remember most of it
 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 >>
 >> WWW:    www.casselbrant.net
 >> E-mail: roland.casselbrant@bonetmail.com
 >> Mobile  phone: +0046-(0)70-4785052
 >>
 >>
 >> -----BEGIN GEEK CODE BLOCK-----
 >> version: 3.12
 >> GCM/CC/IT/O d-(++) s+:+ a C++++ UL+ P+ L+ E- W+++ N++ o K? w++++
 >> O++ M- V+ PS+ PE++ Y+ PGP t--- 5-- X- R* tv++(+) b++ DI+ D G e*
 >> h---- r+++ y++++(+++++)>$
 >> ------END GEEK CODE BLOCK------
 >>
 >>
 >>
 >> E-mail: roland.casselbrant@bonetmail.com              ?
 >> WWW:    www.casselbrant.net                          ,=3D.
 >>                                                     (o o)
 >> ------------------------------------------------ooO--(_)--Ooo--------
 >>
 >>
 >>           I only eat food delivered by www.kummingarden.com
 >>
 >>                                                  .oooO
 >>                                                  (   )   Oooo.
 >> --------------------------------------------------\ (----(   )-------
 >> This signature file may not be reproduced,         \_)    ) /
 >> in whole or in part, by any means,                       (_/
 >> including but not limited to:
 >> Mechanical reprints, electronic storage or scanning, theatrical relea=
se,
 >> musical ballads, word of mouth, sign language, braille, pantomime,
 >> hetero- or asexual reproduction, genetic engineering, or inclusion in
 >> digital media.
 >>                             In the process of producing this e-mail
 >>                               signature file, no apes, ratts, chaffin=
ch,
 >>                    '''        bullys, snouts, CEOs, CIOs or cute pets
 >>                   (0 0)                   came to any harm or danger.
 >>        +-----oOO----(_)----------+
 >>        | Casselbrant Web Factory |
 >>        |     "The Power-Tool     |        The only thing regarded wor=
se
 >>        |       of Internet"      |        than spam mail is excessive
 >>        +------------------oOO----+        signature files like this o=
ne.
 >>                  |__|__|
 >>                   || ||                   Made with love and a editor.
 >>                  ooO Ooo
 >>
 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 >>             Gravity isn't MY fault--I voted for velcro!
 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 >>
 >>
 >>
 >>
 >> ---
 >> Outgoing mail is certified Virus Free.
 >> Checked by AVG anti-virus system (http://www.grisoft.com).
 >> Version: 6.0.454 / Virus Database: 253 - Release Date: 2/10/2003
 >>
 >>
 >>
 >> ---
 >> Incoming mail is certified Virus Free.
 >> Checked by AVG anti-virus system (http://www.grisoft.com).
 >> Version: 6.0.454 / Virus Database: 253 - Release Date: 2/10/2003
 >
 >
 > Bob Gailer
 > mailto:ramrom@earthling.net
 > 303 442 2625
 >
 >
 > ----------------------------------------------------------------------=
--
 >
 >
 > ---
 > Outgoing mail is certified Virus Free.
 > Checked by AVG anti-virus system (http://www.grisoft.com).
 > Version: 6.0.454 / Virus Database: 253 - Release Date: 2/10/2003


--=20
Roland Casselbrant


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
          Seen it all, done it all, can't remember most of it
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

WWW:    www.casselbrant.net
E-mail: roland.casselbrant@bonetmail.com
Mobile  phone: +0046-(0)70-4785052


-----BEGIN GEEK CODE BLOCK-----
version: 3.12
GCM/CC/IT/O d-(++) s+:+ a C++++ UL+ P+ L+ E- W+++ N++ o K? w++++
O++ M- V+ PS+ PE++ Y+ PGP t--- 5-- X- R* tv++(+) b++ DI+ D G e*
h---- r+++ y++++(+++++)>$
------END GEEK CODE BLOCK------



E-mail: roland.casselbrant@bonetmail.com              ?
WWW:    www.casselbrant.net                          ,=3D.
                                                      (o o)
------------------------------------------------ooO--(_)--Ooo--------


            I only eat food delivered by www.kummingarden.com

                                                   .oooO
                                                   (   )   Oooo.
--------------------------------------------------\ (----(   )-------
This signature file may not be reproduced,         \_)    ) /
in whole or in part, by any means,                       (_/
including but not limited to:
Mechanical reprints, electronic storage or scanning, theatrical release,
musical ballads, word of mouth, sign language, braille, pantomime,
hetero- or asexual reproduction, genetic engineering, or inclusion in
digital media.
                              In the process of producing this e-mail

                                signature file, no apes, ratts, chaffinch=
,
                     '''        bullys, snouts, CEOs, CIOs or cute pets
                    (0 0)                   came to any harm or danger.
         +-----oOO----(_)----------+
         | Casselbrant Web Factory |
         |     "The Power-Tool     |        The only thing regarded worse
         |       of Internet"      |        than spam mail is excessive
         +------------------oOO----+        signature files like this one.
                   |__|__|
                    || ||                   Made with love and a editor.
                   ooO Ooo

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
              Gravity isn't MY fault--I voted for velcro!
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


--=20
Roland Casselbrant


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
         Seen it all, done it all, can't remember most of it
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

WWW:    www.casselbrant.net
E-mail: roland.casselbrant@bonetmail.com
Mobile  phone: +0046-(0)70-4785052


-----BEGIN GEEK CODE BLOCK-----
version: 3.12
GCM/CC/IT/O d-(++) s+:+ a C++++ UL+ P+ L+ E- W+++ N++ o K? w++++
O++ M- V+ PS+ PE++ Y+ PGP t--- 5-- X- R* tv++(+) b++ DI+ D G e*
h---- r+++ y++++(+++++)>$
------END GEEK CODE BLOCK------



E-mail: roland.casselbrant@bonetmail.com              ?
WWW:    www.casselbrant.net                          ,=3D.
                                                     (o o)
------------------------------------------------ooO--(_)--Ooo--------


           I only eat food delivered by www.kummingarden.com

                                                  .oooO
                                                  (   )   Oooo.
--------------------------------------------------\ (----(   )-------
This signature file may not be reproduced,         \_)    ) /
in whole or in part, by any means,                       (_/
including but not limited to:
Mechanical reprints, electronic storage or scanning, theatrical release,
musical ballads, word of mouth, sign language, braille, pantomime,
hetero- or asexual reproduction, genetic engineering, or inclusion in
digital media.
                             In the process of producing this e-mail=20

                               signature file, no apes, ratts, chaffinch,
                    '''        bullys, snouts, CEOs, CIOs or cute pets
                   (0 0)                   came to any harm or danger.
        +-----oOO----(_)----------+
        | Casselbrant Web Factory |
        |     "The Power-Tool     |        The only thing regarded worse
        |       of Internet"      |        than spam mail is excessive
        +------------------oOO----+        signature files like this one.
                  |__|__|
                   || ||                   Made with love and a editor.
                  ooO Ooo

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
             Gravity isn't MY fault--I voted for velcro!
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D