Encoding - unicode

2006-01-10 Thread Robert Deskoski
Hi there,

Currently I have a file with germanic names which are, unfortunately in this format:
B\xf6genschutz
As well as being mixed with those who actually have the correct character's in them.
What I am trying to do is convert the characters in the above format to the correct 
format in a text file. The below 5 lines of code work fine, so it changes the static 
line of text correctly, but when it reads lines in from the file, and i strip the endline off, 
it doesn't conver the character's properly. It just keeps them as they are when printed 
and outputted to the screen. 

outfile = open("Output.py", 'w')
ingermanfile = open("GermanNames.txt", 'r')

line = "B\xf6genschutz"
print line.decode("iso-8859-1") 
raw_input("Yeah")
   
   while 1:
  line = ingermanfile.readline()
  if not(line):
 break
  
  try:
  print line
  templine = line[:-1]
  temp = templine.decode("iso-8859-1")   
  print "'" + templine + "'"
  outfile.write(templine + "\n")
  except:
  raw_input("Here we are!")
  outfile.write(line)
  pass
-- 
http://mail.python.org/mailman/listinfo/python-list

popen and stderr

2006-02-01 Thread Robert Deskoski
Hey all,

Currently i'm trying to use popen3 to access stderr - i wanted to use it to output some text to the
parent process, so it can display it (non-console, graphically is what I mean). Is it possible
to write to stderr fromt he child process or, barring this, to attach another stream to the child
process and use that to send back text. I'd use stdout, but it's already being used for console
output.

Thanks for any help given,
Rob
-- 
http://mail.python.org/mailman/listinfo/python-list