Re: Need help to learn Python
Hi! PythonBiter wrote: > I'm very new in this Group as well Python language. I want to learn > Python. So could you please advice me, and guide me how can i become > master in Python ! If you are new to programming in general, too, the "Non-Programmer's Tutorial for Python" is a good start: http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python Cheers, Ben -- http://mail.python.org/mailman/listinfo/python-list
cx_Oracle: Non-ASCII characters handling with different versions
Hi! I have a problem with the cx_Oracle module (Oracle database access): On a computer with cx_Oracle version 4.1 (Python 2.4.3, Oracle 10g) I can get query results consisting of strings including non-ASCII characters, e.g. the code example below outputs "é 0xe9" (which is the correct ISO-8859-1 hex code for "é"). On a newer installation with cx_Oracle 4.3.3 (Python 2.5.1, connecting to the same Oracle 10g server) these characters are interpreted as ASCII (output "e 0x65"). The database encoding is the default (and it's the same DB in both cases anyways); I have no NLS environment environment variables set on either system (I'm running cygwin). The HISTORY file of my more recent cx_Oracle names a few changes related to character sets, but noone strikes me to be relevant for this case. There is non-ASCII data strings in a database, and I need to find a way to get it out correctly. Is anybody able to help me? Thanks! Ben #!/usr/bin/env python import cx_Oracle database = cx_Oracle.connect('login/[EMAIL PROTECTED]') curs = database.cursor() sql = """SELECT CHR(233) FROM DUAL""" curs.execute(sql) result = curs.fetchone()[0] print result, "0x%x" % ord(result) -- http://mail.python.org/mailman/listinfo/python-list
Re: cx_Oracle: Non-ASCII characters handling with different versions
Benjamin Hell wrote: > On a computer with cx_Oracle version 4.1 (Python 2.4.3, Oracle 10g) > I can get query results consisting of strings including non-ASCII > characters, e.g. the code example below outputs "é 0xe9" (which is > the correct ISO-8859-1 hex code for "é"). On a newer installation > with cx_Oracle 4.3.3 (Python 2.5.1, connecting to the same Oracle > 10g server) these characters are interpreted as ASCII (output "e > 0x65"). It's solved: Because of a local full Oracle DB installation the "working" box had the registry key HKEY_LOCAL_SYSTEM\SOFTWARE\ORACLE\KEY_OraBD10g_home1\NLS_LANG set to "AMERICAN_AMERICA.WE8MSWIN1252". A similar key was missing on the other box. I added HKEY_LOCAL_SYSTEM\SOFTWARE\ORACLE\NLS_LANG with the same value and now it works. -- http://mail.python.org/mailman/listinfo/python-list
Determine whether program was started by clicking icon or command line
Hi! I wonder whether there might be a way to find out how a Python program was started (in my case in Windows): By double clicking the file or by calling it on the "DOS" command line prompt. Background: I would like to have the program run in an "interactive mode" if double clicked, and silently in a "batch mode" when started otherwise. Any hints? Thank you! Ben -- http://mail.python.org/mailman/listinfo/python-list
Re: Determine whether program was started by clicking icon or command line
Roger Miller wrote: >> I wonder whether there might be a way to find out how a Python >> program was started (in my case in Windows): By double clicking >> the file or by calling it on the "DOS" command line prompt. > > I'm not sure whether this applies to your situation, but often > programs started by clicking an icon are run by pythonw, but when > started from the command line are run by python. If this is the > case sys.stdin.fileno() will return -1 in the former case and 0 > in the latter. Nice idea, but this... import sys print sys.stdin.fileno() raw_input("Press any key to exit") ... always prints "0" in my case ("DOS", double click in Windows Explorer, Cygwin shell). Thanks anyways! Ben -- http://mail.python.org/mailman/listinfo/python-list
Re: Which is the best book to learn python
On 2011-01-26 01:43 , Luis M. González wrote: > On Jan 24, 2:09 pm, santosh hs wrote: >> i am beginner to python please tell me which is the best available >> reference for beginner to start from novice > > If you are a complete beginner to programming, I suggest start with a > tutorial such as "A Byte of Python" (google this). > I learned my first steps with Josh Cogliati's "Non-Programmers > Tutorial For Python" > http://www.oopweb.com/Python/Documents/easytut/VolumeFrames.html Josh moved this tutorial to Wikibooks some years ago, where it has been improved since then. Today there are two versions, one for Python 2.x and one for Python 3: http://en.wikibooks.org/wiki/Non-Programmer's_Tutorial_for_Python_2.6 http://en.wikibooks.org/wiki/Non-Programmer's_Tutorial_for_Python_3 I have used it to introduce people to programming with very good results. If you want to get the maximum out of Lutz & Asher's "Learning Python", which is a very good book as well, you should have programmed in some way before. Ben -- http://mail.python.org/mailman/listinfo/python-list