[Tutor] converting EBCIDIC to ASCII

2012-07-13 Thread Prinn, Craig
I am trying to convert an EBCIDIC file to ASCII, when the records are fixed 
length I can convert it fine, I have some files that are coming in as variable 
length records, is there a way to convert the file in Python? I tried using no 
length but then it just reads in to a fixed buffer size and I can't seem to 
break the records properly

Craig Prinn
Manager, Data Management
Phone: 919-767-6640
Cell: 410-320-9962
Address: Bell and Howell
  3600 Clipper Mill Road
  Suite 404
  Baltimore MD 21211

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Converting ebcidic to ascii

2011-06-15 Thread Prinn, Craig
quot; become "stdscr" but if I
> > obviously can not even define any new methods or properties. But atleast
> > the references can be used through out the class with out crashing."""
> > import curses
> > class CursesApp:
> >def __init__(self, stdscr):
> >self.Screen=stdscr #This is the stdscr object.
> >curses.init_pair(1,curses.COLOR_BLUE,curses.COLOR_YELLOW)
> >self.Screen.bkgd(' ', curses.color_pair(1))
> >self.mainLoop()
> >
> >def mainLoop(self):
> >while 1:
> >self.Screen.refresh()
> >key=self.Screen.getch()
> >if key==ord('q'): break
> >
> > def main():
> >cursesapp = curses.wrapper(setup)
> >
> > def setup(stdscr):
> >CursesApp(stdscr)
> >
> > if __name__ == '__main__':
> >main()
> >
> > ___
> > Tutor maillist  -  Tutor@python.org
> > To unsubscribe or change subscription options:
> > http://mail.python.org/mailman/listinfo/tutor
> >




--

Message: 2
Date: Wed, 15 Jun 2011 02:20:27 -0700
From: "Mark Tolonen" 
To: tutor@python.org
Subject: Re: [Tutor] trying to translate and ebcidic file
Message-ID: 
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original


"Prinn, Craig"  wrote in message 
news:6b49a56a6e493f4eba255f6f197f070f050e4fe...@bbh-mail1.bbh.priv...
> I am looking for a way to translate and ebcidic file to ascii. Is there a 
> pre-existing library for this, or do I need to do this from scratch? If
 > from scratch and ideas on where to start?

There are a couple of EBCDIC codecs (see list of codecs in 
http://docs.python.org/library/codecs.html).

Try:open('file.txt').read().decode('ibm500').encode('ascii','replace')

You'll get '?' for chars ascii doesn't support.

-Mark





--

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


End of Tutor Digest, Vol 88, Issue 54
*
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] trying to translate and ebcidic file

2011-06-14 Thread Prinn, Craig
I am looking for a way to translate and ebcidic file to ascii. Is there a 
pre-existing library for this, or do I need to do this from scratch? If from 
scratch and ideas on where to start?
thanks

Craig Prinn
Document Solutions Manager
Office Phone 919-767-6640
Cell Phone410-320-9962
Fax  410-243-0973
3600 Clipper Mill Road
Suite 404
Baltimore, MD 21211

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor