Re: piping out binaries properly

2005-10-11 Thread Mike Meyer
Andy Leszczynski writes: > I have got following program: > > import sys > import binascii > from string import * > sys.stdout.write(binascii.unhexlify("41410A4141")) > > > when I run under Unix I got: > > $ python u.py > u.bin > $ od -t x1 u.bin > 000 41 41 0a 41 41 > > and under Windows/Cygwi

Re: are there internal functions for these ?

2005-10-11 Thread Steven D'Aprano
black wrote: > anyone could figure me out ? No, I suspect people would have to be a trained psychologist to figure you out. *wink* -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Re: non descriptive error

2005-10-11 Thread Steven D'Aprano
Timothy Smith wrote: >>> i have NO idea what in there could be making it have such a strange >>> error. it just says "error" when you try run it. there nothing terribly >>> strange being done. > i am still coming across this error it's driving me nuts. usually i can > find what's wrong, but it i

Re: piping out binaries properly

2005-10-11 Thread Andy Leszczynski
Mike Meyer wrote: > It's not normal to write binary content to stdout - you normally write Well, I grew up in the Unix world and it is normal over there. I am still curious which layer adds that 0xd. Is it python, cygwin, windows ... Thx for reply, Andy -- http://mail.python.org/mailman/listin

Re: Can module access global from __main__?

2005-10-11 Thread Neal Norwitz
Steve Holden wrote: > Neal Becker wrote: > > > > Still curious about the answer. If I know that I am imported from __main__, > > then I can do access X as sys.modules[__main__].X. In general, I don't > > know how to determine who is importing me. > > > I don't think you can without huge amounts o

Re: are there internal functions for these ?

2005-10-11 Thread Grant Edwards
On 2005-10-12, black <[EMAIL PROTECTED]> wrote: > i wrote some functions for copying and moving files caz' i didnt find > concret functions within the doc. but i think these operations are > simple and important so there may be some internal ones i didnt know. http://www.google.com/search?hl=en&q

Re: Parser suggestion

2005-10-11 Thread [EMAIL PROTECTED]
Take a look at PLY. There is an example lexer in the download for parsing fortran. -- http://mail.python.org/mailman/listinfo/python-list

Re: piping out binaries properly

2005-10-11 Thread marduk
On Wed, 2005-10-12 at 00:16 -0400, Mike Meyer wrote: [...] > It's not normal to write binary content to stdout - you normally write > it to a file. Open the file with open(name, 'wb') to write binaries. > It is interesting that as a "Unix consultant" you should make that claim. Especially since

Re: piping out binaries properly

2005-10-11 Thread Mike Meyer
Andy Leszczynski writes: > Mike Meyer wrote: >> It's not normal to write binary content to stdout - you normally write > > Well, I grew up in the Unix world and it is normal over there. I watched the Unix world grow up, and it ain't normal to me. I don't think I've ever written a program that wr

Re: win32com, generating the cache programaticaly?

2005-10-11 Thread Roger Upole
"Andrew Markebo" wrote: > > Hello! > > I am messing around with communicating between LabVIEW and Python, got > it to work by a small 'fix' (grabbing the generated file, and > importing it by hand) > > What I might want to do, is to automatically generate the data done by > executing makepy.py and

Re: TurboGears /.-ed, >new == True< or >new == "True"

2005-10-11 Thread Fredrik Lundh
Andy Leszczynski wrote: > watch this: > http://www.turbogears.org.nyud.net:8090/docs/wiki20/20MinuteWiki.mov > > or read this: > http://www.turbogears.org.nyud.net:8090/docs/wiki2 0/page4.html > > should not it be: > > 2 def save(self, pagename, data, submit, new): > 3 hub.begin() > 4 if new == Tr

Re: piping out binaries properly

2005-10-11 Thread Erik Max Francis
Mike Meyer wrote: > I watched the Unix world grow up, and it ain't normal to me. Since there's no distinction between a file opened in binary mode and in text mode on Unix, there is no difference. > I don't > think I've ever written a program that wrote binary data to standard > out, not in nea

bizarro world (was Re: Python Doc Problem Example: sort() (reprise))

2005-10-11 Thread Bryan
Xah Lee wrote: > Addendum, 200510 > > Here's further example of Python's extreme low quality of > documentation. In particular, what follows focuses on the bad writing > skill aspect, and comments on some language design and quality issues > of Python. > >>From the Official Python documentation o

Re: TurboGears /.-ed, >new == True< or >new == "True"

2005-10-11 Thread Sybren Stuvel
Andy Leszczynski enlightened us with: > should not it be: > > 2 def save(self, pagename, data, submit, new): > 3 hub.begin() > 4 if new == True: > 5 page = Page(pagename=pagename, data=data) > 6 else: > 7 page = Page.byPagename(pagename) > 8 page.data = data > > instead of: > > 4 if new

Re: bizarro world (was Re: Python Doc Problem Example: sort() (reprise))

2005-10-11 Thread Bryan
mr. xah... would you be willing to give a lecture at pycon 2006? i'm sure you would draw a huge crowd and a lot of people would like to meet you in person... thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: piping out binaries properly

2005-10-11 Thread Mike Meyer
marduk <[EMAIL PROTECTED]> writes: > On Wed, 2005-10-12 at 00:16 -0400, Mike Meyer wrote: > [...] >> It's not normal to write binary content to stdout - you normally write >> it to a file. Open the file with open(name, 'wb') to write binaries. >> > > It is interesting that as a "Unix consultant"

Re: piping out binaries properly

2005-10-11 Thread Paul Rubin
Erik Max Francis <[EMAIL PROTECTED]> writes: > > I've written lots of things whose standard out was designed > > specifically to be read by another program, but never as binary data. > > Plenty of applications use that functionality and depend on it. See > cjpeg, djpeg, the pbmplus library, and s

Re: bizarro world (was Re: Python Doc Problem Example: sort() (reprise))

2005-10-11 Thread Lasse Vågsæther Karlsen
Bryan wrote: > mr. xah... would you be willing to give a lecture at pycon 2006? i'm > sure you would draw a huge crowd and a lot of people would like to meet > you in person... > > thanks. > I think that would be a highly un-pythonesque crowd. Python isn't much in the sense of limitations, b

Adding a __filename__ predefined attribute to 2.5?

2005-10-11 Thread Rune Strand
Is it an idea to include a new __filename__ predefined attribute to 2.5, so that __file__ contains the entire path to the module, and __filename__ only the name of the module? For instance it's useful to include a not-static reference to the filename in a scripts usage() section and it's cumbersom

Re: piping out binaries properly

2005-10-11 Thread Fredrik Lundh
Andy Leszczynski wrote: > when I run under Unix I got: > > $ python u.py > u.bin > $ od -t x1 u.bin > 000 41 41 0a 41 41 > > and under Windows/Cygwin following: > > $ python u.py > u.bin > $ od -t x1 u.bin > 000 41 41 0d 0a 41 41 > 006 > > The question is how can I pipe out binary cont

<    1   2   3