Linux endline

Fabien Hénon ffjhenon at club-internet.fr
Sat Mar 16 06:28:01 EST 2002


I am writing a POV-RAY editor which can be used with Windows or Linux.

1° When I use it under Linux I would like to get rid of the \r which
appears at the end of each line. ( I know there is a difference of
endline between Windows, Mac and Linux).

I added a slice, but it doesn't seem to work.
I tried to use
  self.text.insert(END, line[:-1])
But it does not help
In short how do I get rid of endline in *nix

----
def enter_text(self):
        if plat=="win32":
          l=1
          self.filename = askopenfilename()
          if self.filename:
    self.text.delete(1.0, END)
  fd = open(self.filename)
   for line in fd.readlines():
  l=l+1
  self.text.insert(END, line)
   fd.close()
        elif plat=="linux-i386":
          l=1
          self.filename = askopenfilename()
          if self.filename:
    self.text.delete(1.0, END)
  fd = open(self.filename)
   for line in fd.readlines():
  l=l+1
  self.text.insert(END, line) # self.text.insert(END, line[:-1])
   fd.close()
-----------


2° One more thing, I'd like to add syntax highlighting with braces,
parentheses,.... matching.
I'd like to know it is feasible to implement it.


3° Is there a way to fire up an external application (like POV or a
modeler) in background or as a sub-thread :
When I start POV from within the application, I have to wait for the
raytracing to be over to use the editor again.

I use
  os.system("application_to_run")

Thanks for any help










More information about the Python-list mailing list