Re: Interpretation

2016-03-26 Thread Steven D'Aprano
On Sat, 26 Mar 2016 03:33 am, Dennis Ngeno wrote: > My programs have never combile, they keep telling me , systax error even > after copy pasting Dennis, if Python is complaining that you have a SyntaxError, it means you have written something which the interpreter cannot understand. We cannot po

Re: Interpretation

2016-03-26 Thread Steven D'Aprano
On Sun, 27 Mar 2016 02:22 pm, Mario R. Osorio wrote: > OTOH, python code is not supposed to be compiled. Technically, Python code is compiled, to byte-code rather than machine-code, but still compiled. That's what is inside the .pyc files you will often see after importing modules. And Python ev

Re: Interpretation

2016-03-26 Thread Ben Finney
"Mario R. Osorio" writes: > On Saturday, March 26, 2016 at 5:59:04 AM UTC-4, Dennis Ngeno wrote: > > My programs have never combile, they keep telling me , systax error even > > after copy pasting > > No pun intended, but I hope you are not typing your code like you > typed your message. Many pe

Re: Interpretation

2016-03-26 Thread Mario R. Osorio
On Saturday, March 26, 2016 at 5:59:04 AM UTC-4, Dennis Ngeno wrote: > My programs have never combile, they keep telling me , systax error even > after copy pasting No pun intended, but I hope you are not typing your code like you typed your message. OTOH, python code is not supposed to be compi

Re: Interpretation

2016-03-26 Thread Mark Lawrence
On 25/03/2016 16:33, Dennis Ngeno wrote: My programs have never combile, they keep telling me , systax error even after copy pasting Please show us your code and the exact syntax error. What Python version and OS are you using? -- My fellow Pythonistas, ask not what our language can do for

Interpretation

2016-03-26 Thread Dennis Ngeno
My programs have never combile, they keep telling me , systax error even after copy pasting -- https://mail.python.org/mailman/listinfo/python-list

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Piet van Oostrum
Nils Bunger writes: > Hi Neil, > > Thanks for looking at this. > > I'm trying to create a multipart MIME for an HTTP POST request, not an > email. This is for a third-party API that requires a multipart POST > with a binary file, so I don't have the option to just use a different > encoding. >

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Nils Bunger
Hi all, I was able to workaround this problem by encoding a unique 'marker' in the binary part, then replacing the marker with the actual binary content after generating the MIME message. See my answer on Stack Overflow http://stackoverflow.com/a/19033750/526098 for the code. Thanks, your s

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Nils Bunger
Hi Neil, Thanks for looking at this. I'm trying to create a multipart MIME for an HTTP POST request, not an email. This is for a third-party API that requires a multipart POST with a binary file, so I don't have the option to just use a different encoding. Multipart HTTP is standardized in

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-26 Thread Neil Cerutti
On 2013-09-26, Chris Angelico wrote: > On Thu, Sep 26, 2013 at 2:23 PM, Nils Bunger wrote: >> Yes, it's email.mime.MIMEApplication. I've pasted a snippet >> with the imports below. >> >> I'm trying to use this to build a multi-part MIME message, >> with this as one part. >> >> I really can't figu

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-25 Thread Chris Angelico
On Thu, Sep 26, 2013 at 2:23 PM, Nils Bunger wrote: > Yes, it's email.mime.MIMEApplication. I've pasted a snippet with the imports > below. > > I'm trying to use this to build a multi-part MIME message, with this as one > part. > > I really can't figure out any way to attach a binary part like t

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-25 Thread Nils Bunger
Chris, Thanks for answering. Yes, it's email.mime.MIMEApplication. I've pasted a snippet with the imports below. I'm trying to use this to build a multi-part MIME message, with this as one part. I really can't figure out any way to attach a binary part like this to a multi-part MIME messa

Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-25 Thread Chris Angelico
On Thu, Sep 26, 2013 at 2:38 AM, wrote: > app = MIMEApplication(b'Q\x0dQ', _encoder=encode_noop) What is MIMEApplication? It's not a builtin, so your test case is missing an import, at least. Is this email.mime.MIMEApplication? ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2

2013-09-25 Thread nilsbunger
Hi, I'm having trouble encoding a MIME message with a binary file. Newline characters are being interpreted even though the content is supposed to be binary. This is using Python 3.3.2 Small test case: app = MIMEApplication(b'Q\x0dQ', _encoder=encode_noop) b = io.BytesIO() g = BytesGenerator

Re: Unicode literals and byte string interpretation.

2011-10-31 Thread Fletcher Johnson
On Oct 28, 3:06 am, Steven D'Aprano wrote: > On Thu, 27 Oct 2011 20:05:13 -0700, Fletcher Johnson wrote: > > If I create a newUnicodeobject u'\x82\xb1\x82\xea\x82\xcd' how does > > this creation process interpret the bytes in the byte string? > > It doesn't, because there is no byte-string. You ha

Re: Unicode literals and byte string interpretation.

2011-10-28 Thread Steven D'Aprano
On Thu, 27 Oct 2011 20:05:13 -0700, Fletcher Johnson wrote: > If I create a new Unicode object u'\x82\xb1\x82\xea\x82\xcd' how does > this creation process interpret the bytes in the byte string? It doesn't, because there is no byte-string. You have created a Unicode object from a literal strin

Re: Unicode literals and byte string interpretation.

2011-10-27 Thread Chris Angelico
On Fri, Oct 28, 2011 at 2:05 PM, Fletcher Johnson wrote: > If I create a new Unicode object u'\x82\xb1\x82\xea\x82\xcd' how does > this creation process interpret the bytes in the byte string? Does it > assume the string represents a utf-16 encoding, at utf-8 encoding, > etc...? > > For reference

Re: Unicode literals and byte string interpretation.

2011-10-27 Thread David Riley
On Oct 27, 2011, at 11:05 PM, Fletcher Johnson wrote: > If I create a new Unicode object u'\x82\xb1\x82\xea\x82\xcd' how does > this creation process interpret the bytes in the byte string? Does it > assume the string represents a utf-16 encoding, at utf-8 encoding, > etc...? > > For reference th

Unicode literals and byte string interpretation.

2011-10-27 Thread Fletcher Johnson
If I create a new Unicode object u'\x82\xb1\x82\xea\x82\xcd' how does this creation process interpret the bytes in the byte string? Does it assume the string represents a utf-16 encoding, at utf-8 encoding, etc...? For reference the string is これは in the 'shift-jis' encoding. -- http://mail.python

Re: interpretation of special characters in Python

2008-07-07 Thread TP
Peter Pearson wrote: > I don't understand exactly what you mean by "Sorry" I means: please forgive me for having said that it does not work with variables, because it is completely false. Thanks one more time Julien -- TP (Tribulations Parallèles) "Allez, Monsieur, allez, et la foi vous vien

Re: interpretation of special characters in Python

2008-07-07 Thread Peter Pearson
i) stored in a python variable > > Sorry, it works when using variables. Try for example: > > col="[0;31m" > esc="\033" > colreset="[0m" > print esc + col + "foobar" + esc + colreset I don't understand exactly what you mean by "

Re: interpretation of special characters in Python

2008-07-07 Thread TP
Peter Otten wrote: esc = os.environ["esc"].decode("string-escape") esc > '\x1b' print "%s[30;44malles so schoen bunt hier%s[0m" % (esc, esc) > alles so schoen bunt hier Thanks a lot for your help. It works perfectly. Indeed, one can read in the documentation concerning encodings:

Re: interpretation of special characters in Python

2008-07-07 Thread Peter Otten
t; characters into a single escape character. > > One of this group's regular participants can (I hope) tell > us three breathtakingly elegant ways to do that. I'm sorry > I can't. > > When you run echo, it recognizes the 4-character "esc" as a > conv

Re: interpretation of special characters in Python

2008-07-07 Thread TP
TP wrote: > So, the python print command *can* interpret these 4-character as a single > character. It would be odd if there were no possibility to do the same > thing when the characters are (i) stored in a python variable Sorry, it works when using variables. Try for example: col="[0;31m" esc=

Re: interpretation of special characters in Python

2008-07-07 Thread Ben Finney
TP <[EMAIL PROTECTED]> writes: > Peter Pearson wrote: > > > When you tell python "print '\033[30;44m foo \033[0m'", python > > interprets the "\033" as a single character. > > So, the python print command *can* interpret these 4-character as a > single character. Not "interpret", no. It's more

Re: interpretation of special characters in Python

2008-07-06 Thread TP
Peter Pearson wrote: Thanks for your answer. > When you run echo, it recognizes the 4-character "esc" as a > convention for representing a single character, and performs > the re-interpretation for you. When you tell python > "print '\033[30;44m foo \033[0m'

Re: interpretation of special characters in Python

2008-07-06 Thread TP
Dennis Lee Bieber wrote: > Off-hand, I'd probably try first with: > > csi = "\033[" > > and then define your > > colorblackondarkblue = $csi"30;44m" Thanks for your answer. I have tried this slight modification, but it does not change anything on my terminal. -- TP (Tribulations Parallèles)

Re: interpretation of special characters in Python

2008-07-06 Thread Peter Pearson
r shell variable "esc" is 4 characters long. Your Python program prints those four characters. You want it to re-interpret those 4 characters into a single escape character. One of this group's regular participants can (I hope) tell us three breathtakingly elegant ways to do that.

interpretation of special characters in Python

2008-07-06 Thread TP
efined these shell variables in a shell: $ export esc="\033" $ export ColorBlackOnDarkblue="[30;44m" $ export ColorReset="[0m" When I execute the Python script, I do not obtain any special character interpretation in Python: $ python color.py \033[30;44m foo \03

Re: yield expression programmized-formal interpretation. (interpretation of yield expression.)

2008-04-21 Thread Gabriel Genellina
En Mon, 21 Apr 2008 15:03:05 -0300, <[EMAIL PROTECTED]> escribió: What if I say oath= yield or other= yield ? Does yield evaluate without parenthes? (Eth.) You can't use yield except in a generator function. From and the grammar definit

yield expression programmized-formal interpretation. (interpretation of yield expression.)

2008-04-21 Thread castironpi
What if I say oath= yield or other= yield ? Does yield evaluate without parenthes? (Eth.) -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib interpretation of URL with ".."

2007-06-27 Thread sergio
Gabriel Genellina wrote: > En Tue, 26 Jun 2007 17:26:06 -0300, sergio <[EMAIL PROTECTED]> > escribió: > >> John Nagle wrote: >> >>> In Python, of course, "urlparse.urlparse", which is >>> the main function used to disassemble a URL, has no idea whether it's >>> being used by a client or a server

Re: urllib interpretation of URL with ".."

2007-06-26 Thread Gabriel Genellina
En Tue, 26 Jun 2007 17:26:06 -0300, sergio <[EMAIL PROTECTED]> escribió: > John Nagle wrote: > >> In Python, of course, "urlparse.urlparse", which is >> the main function used to disassemble a URL, has no idea whether it's >> being used by a client or a server, so it, reasonably enough, takes

Re: urllib interpretation of URL with ".."

2007-06-26 Thread sergio
John Nagle wrote: > In Python, of course, "urlparse.urlparse", which is > the main function used to disassemble a URL, has no idea whether it's > being used by a client or a server, so it, reasonably enough, takes option > 1. >>> import urlparse >>> base="http://somesite.com/level1/"; >>> path="

Re: urllib interpretation of URL with ".."

2007-06-25 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: > Duncan Booth wrote: >> "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> >> Is "urllib" wrong? > >> Section 5.2 is also relevant here. In particular: >> >> >>> g) If the resulting buffer string still begins with one or more >>> complete path

Re: urllib interpretation of URL with ".."

2007-06-25 Thread John Nagle
Duncan Booth wrote: > "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > >>>Is "urllib" wrong? > Section 5.2 is also relevant here. In particular: > > >> g) If the resulting buffer string still begins with one or more >> complete path segments of "..", then the reference is >>

Re: urllib interpretation of URL with ".."

2007-06-25 Thread Duncan Booth
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> Is "urllib" wrong? > > I can't see how. HTTP 1.1 says that the parameter to the GET > request should be an abs_path; RFC 2396 says that > /../acatalog/shop.html is indeed an abs_path, as .. is a valid > segment. That RFC also has a section on relati

Re: urllib interpretation of URL with ".."

2007-06-23 Thread John Nagle
> Notice the "and only when": the browsers who modify above > URL before sending it seem to be in clear violation of > RFC 2396. > > Regards, > Martin I think you're right. The problem is that there is apparently a de-facto standard in browsers that any n

Re: urllib interpretation of URL with ".."

2007-06-23 Thread Martin v. Löwis
John Nagle schrieb: > Here's a URL, found in a link, which gives us trouble > when we try to follow the link: > > http://sportsbra.co.uk/../acatalog/shop.html > > Browsers immediately turn this into > > http://sportsbra.co.uk/acatalog/shop.html > > and go from there, but urllib tries to

urllib interpretation of URL with ".."

2007-06-22 Thread John Nagle
Here's a URL, found in a link, which gives us trouble when we try to follow the link: http://sportsbra.co.uk/../acatalog/shop.html Browsers immediately turn this into http://sportsbra.co.uk/acatalog/shop.html and go from there, but urllib tries to open it explicitly, which resul

Interpretation of UnhandledException.rpt

2006-06-06 Thread Gregor Horvath
Hi, in a windows server python application I receive once a week suddenly and not reproducible the following error. UnhandledException.rpt file: //=== Exception code: C090 FLT_INVALID_OPER

Re: Python & Unicode decimal interpretation

2005-12-03 Thread Martin v. Löwis
Scott David Daniels wrote: >> >>> int(u"\N{DEVANAGARI DIGIT SEVEN}") >> 7 > > OK, That much I have handled. I am fiddling with direct-to-number > conversions and wondering about cases like >>>> int(u"\N{DEVANAGARI DIGIT SEVEN}" + XXX >+ u"\N{DEVANAGARI DIGIT SEVEN}") int() passe

Re: Python & Unicode decimal interpretation

2005-12-03 Thread Scott David Daniels
Martin v. Löwis wrote: > Scott David Daniels wrote: >> In reading over the source for CPython's PyUnicode_EncodeDecimal, >> I see a dance to handle characters which are neither dec-equiv nor >> in Latin-1. Does anyone know about the intent of such a conversion? > > To support this: > > >>> int(

Re: Python & Unicode decimal interpretation

2005-12-03 Thread Martin v. Löwis
ere that > they would not if these characters were treated as a character like '?'? > > Can someone either give me definitive "why not" or (preferably) give > me a test case that shows where that interpretation does not hold. In the "ignore" case, no outp

Python & Unicode decimal interpretation

2005-12-02 Thread Scott David Daniels
" or (preferably) give me a test case that shows where that interpretation does not hold. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list