error: an integer is required

jeni madigreece at yahoo.gr
Sun Jun 14 06:31:43 EDT 2009


On 8 Ιούν, 21:46, Terry Reedy <tjre... at udel.edu> wrote:
> madigre... at yahoo.gr wrote:
> > I execute my code in linux environment.
> > My code is:
>
> > from os import *
>
> > def insert_text_file(self, strng):
> >      t=open("elements_file.txt", "a")
> >      t.write(strng)
> >      t.close()
>
> > I'm getting this error:
>
> > <type 'exception.TypeError'>: an integer is required
>
> > Where is the mistake?
> > Help me, please!!
>
> Tell us the Python version and give the *full* traceback message, not
> just the last line.  I am pretty sure you also left out an important
> part of the code you executed to get that message.
>
> tjr- Απόκρυψη κειμένου σε παράθεση -
>
> - Εμφάνιση κειμένου σε παράθεση -

With both import os and os.open there is the same error. I have
developed in python a game for OPLC. When I run the game in Python
2.5.2 at Windows there is no problem. But after I play a game at OLPC
I get the following message:


<type 'exceptions.TypeError'> Traceback (most recent call last)

/home/olpc/Activities/Kremala.activity/Kremala.py in add_letter
(self=<KremalaActivity object at 0x83e22d4 (SugarActivity at 0x86a7800)
>, widget=<gtk.Button object at 0x83f49dc (GtkButton at 0x8744920)>,
grama='i')
-->   self.find_w()
  self.find_w=<bound method KremalaActivity.find_w of <KremalaActivity
object at 0x83e22d4 (SugarActivity at 0x86a7800)>>

/home/Activities/Kremala.activity/Kremala.py in find_w
(self=<KremalaActivity object at 0x83e22d4 (SugarActivity at 0x86a7800)
>)
      self.show_gr()
-->     self.sosti_leksi()
   self.sosti_leksi==<bound method KremalaActivity.sosti_leksi of
<KremalaActivity object at 0x83e22d4 (SugarActivity at 0x86a7800)>>

/home/Activities/Kremala.activity/Kremala.py in sosti_leksi
(self=<KremalaActivity object at 0x842e2fc (SugarActivity at 0x86b3000)
>)
      s=self.categ+":"+str(1)+" nikh me "+str(6-self.m)+"prospatheies
\n"
-->     self.insert_text_file(s)
    self.insert_text_file===<bound method
KremalaActivity.insert_text_file of <KremalaActivity object at
0x83e22d4 (SugarActivity at 0x86a7800)>>

/home/Activities/Kremala.activity/Kremala.py in insert_text_file
(self=<KremalaActivity object at 0x83e22d4 (SugarActivity at 0x86a7800)
>, strng='geografia:1 nikh me 2 prospatheies\n')
-->      t=open("elements_file.txt", "a")
    global open=<built-in function open>
          t.write(strng)
          t.close()

<type 'exceptions.TypeError'>: an integer is required

OLPC's software is important?



More information about the Python-list mailing list