Re: Need compile python code

2006-09-23 Thread mistral
MonkeeSage писал(а): > mistral wrote: > > No, something is wrong there. what I need is just compile one python > > file which will generate html page, with parameters: > > "exec" "python" "-O" "$0" "$@" > > > > just need simple way do this(script is correct), i will not set any > > patches anywh

Re: Converting Perl Web Report to Python

2006-09-23 Thread [EMAIL PROTECTED]
Dennis, Wow! Talk about RAD development... Nice job... Errr, real nice job. I will test your concepts and see how it works. Thanks a ton. You far exceeded my expectations! Pat Dennis Lee Bieber wrote: > On 23 Sep 2006 06:04:16 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > declaimed the follo

Re: Fatal error after RE-installing Python 2.3.4

2006-09-23 Thread John Machin
Cappy2112 wrote: > > > Some thoughts and questions: > > 1. Telling us what the allegedly spurious pychecker warnings were would > > be a good idea. > > pychecker isn't really a concern at this point- and has ben uninstalled > (actually deleted, since there is no installer/uninstaller for this > p

Re: Strange __future__ behavior in Python 2.5

2006-09-23 Thread Avizoa
[EMAIL PROTECTED] wrote: > My understanding of the __future__ statement is that you may say > something like: > > from __future__ import foo, bar > > to enable more than one feature. However, this does not seem to be > working properly in 2.5; it behaves as expected when typed into the > interacti

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-23 Thread John Roth
Saizan wrote: > John Roth wrote: > > > The not operator and the bool() builtin produce > > boolean results. Since bool is a subclass of int, > > all the integer operations will remain integer > > operations. This was done for backwards > > compatability, and is unlikely to change in the 2.x > > se

Re: QuoteSQL

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Anders J. Munch wrote: > Lawrence D'Oliveiro wrote: >> Why doesn't MySQLdb provide a function like this: >> >> def QuoteSQL(Str, DoWild) : >> """returns a MySQL string literal which evaluates to Str. Needed >> for those times when MySQLdb's automatic quotin

Re: A critique of cgi.escape

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Lawrence D'Oliveiro wrote: > >> So I think the default for the second argument to cgi.escape should be >> changed to True. Or alternatively, the second argument should be removed >> altogether, and quotes should always be escaped. > > you're

Re: Reverse a String?

2006-09-23 Thread Gregory Piñero
Thanks guys, and now the world knows: http://www.answermysearches.com/index.php/super-easy-way-to-reverse-a-string-in-python/188/ Well my 3 blog readers or the world ... not sure. -Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: webbrowser module's Firefox support

2006-09-23 Thread MonkeeSage
Dustan wrote: > I did do a search here, but came up empty-handed. Can anyone tell me > how to get the webbrowser module to recognize firefox's existence, > given this information? Looks like it is checking %PATH% for firefox.exe. Try: >>> import os >>> os.environ["PATH"] = r"C:\Program Files\Mozi

Re: Need compile python code

2006-09-23 Thread John Machin
mistral wrote: > писал(а): There seems to be a rather large communication gap. Consider asking your question in a Russian-speaking Python-related forum, for example: http://zope.net.ru/ Regards, John -- http://mail.python.org/mailman/listinfo/python-list

Re: webbrowser module's Firefox support

2006-09-23 Thread Dustan
MonkeeSage wrote: > Dustan wrote: > > I did do a search here, but came up empty-handed. Can anyone tell me > > how to get the webbrowser module to recognize firefox's existence, > > given this information? > > Looks like it is checking %PATH% for firefox.exe. Try: > > >>> import os > >>> os.enviro

Re: QuoteSQL

2006-09-23 Thread Robert Kern
Anders J. Munch wrote: > Always sad to see an SQL DBMS willfully violate the SQL standard. You must be a constantly depressed person, then. :-) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpr

Re: Looking for opinions

2006-09-23 Thread crystalattice
Bruno Desthuilliers wrote: > I have few experience with RPG softwares, but if your "domain" logic si > anything more than trivially complex, it's always better to keep it as > decoupled as possible from the user interface (unless of course the user > interface actually is the domain !-). FWIW, thi

Building Vim against Python 2.5

2006-09-23 Thread [EMAIL PROTECTED]
[Any python/C interface gurus please correct me if my understanding is wrong, as this fix is slated for inclusion in future versions of vim--thanks!] Just as a heads up for anyone building vim with python2.5 as the extension language: Simple solution: Python 2.5 has tightened up how it does memor

assignment hook

2006-09-23 Thread paul . lafollette
Kind people, Is there any way one can, within Python, intercept the act of assignment. For instance, suppose that I was obsessed with FORTRAN II, and decided that I wanted to print a warning, or raise an exception any time someone assigned an int to a variable whose name did not start with i,j,k,l

Re: webbrowser module's Firefox support

2006-09-23 Thread MonkeeSage
Dustan wrote: > >>> cont=webbrowser._browsers['firefox'][1] Why not use the api? cont=webbrowser.get('firefox') > ValueError: close_fds is not supported on Windows platforms > > Looking in the docs on subprocess.Popopen > (http://docs.python.org/lib/node529.html), it says "If close_fds is > true,

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-23 Thread MonkeeSage
Bjoern Schliessmann wrote: > Thanks. Only if I'd known that earlier ;) NP. I had to look it up 'cause I'd never seen them used either. Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: webbrowser module's Firefox support

2006-09-23 Thread Dustan
MonkeeSage wrote: > Dustan wrote: > > >>> cont=webbrowser._browsers['firefox'][1] > > Why not use the api? cont=webbrowser.get('firefox') That didn't work either. > > ValueError: close_fds is not supported on Windows platforms > > > > Looking in the docs on subprocess.Popopen > > (http://docs.py

Re: assignment hook

2006-09-23 Thread Roy Smith
[EMAIL PROTECTED] wrote: > Kind people, > Is there any way one can, within Python, intercept the act of > assignment. Sure. You just need to define a __setattr__() method for your class. See http://docs.python.org/ref/attribute-access.html for details. > For instance, suppose that I was obses

Re: Looking for opinions

2006-09-23 Thread Robert Kern
crystalattice wrote: > Bruno Desthuilliers wrote: >> I have few experience with RPG softwares, but if your "domain" logic si >> anything more than trivially complex, it's always better to keep it as >> decoupled as possible from the user interface (unless of course the user >> interface actually is

Extended slices and indices

2006-09-23 Thread GavinCrooks
The indices method of slice doesn't seem to work quite how I would expect when reversing a sequence. For example : >>> s = '01234' >>> s[::-1] '43210' >>> s[slice(None,None,-1) ] '43210' So a slice with a negative step (and nothing else) reverses the sequence. But what are the corresponding indi

Re: webbrowser module's Firefox support

2006-09-23 Thread MonkeeSage
Dustan wrote: > That didn't work either. Well, I'm out of ideas. It's also odd that it was being read as webbrowser.BackgroundBrowser...whatever that is! It should have been webbrowser.Mozilla. > Another thing: your fix is only temporary. Is there a way to make it > work even after I close IDLE?

HTTP GET Explodes...

2006-09-23 Thread Pete
I was running the HTTP GET example at http://www.python.org/doc/current/lib/httplib-examples.html and ran into a bit of trouble... >>> import httplib # This works. >>> conn = httplib.HTTPConnection("www.python.org") # This works. >>> conn.request("GET", "/index.html") # This does not work... T

Re: assignment hook

2006-09-23 Thread John Machin
Roy Smith wrote: > [EMAIL PROTECTED] wrote: > > Kind people, > > Is there any way one can, within Python, intercept the act of > > assignment. > > Sure. You just need to define a __setattr__() method for your class. See > http://docs.python.org/ref/attribute-access.html for details. Is it possi

Re: Running Python script from C++ code(.NET)

2006-09-23 Thread Ravi Teja
> A trivial question - I have a working Python script that I have to > invoke from C++ code. No fancy stuff - just run the whole script with > its parameters. No callbacks, no signalling - nada, just > stupid,primitive, straightforward call. > > And while there is a lot of help on embedding, I coul

Re: Running Python script from C++ code(.NET)

2006-09-23 Thread Ravi Teja
> A trivial question - I have a working Python script that I have to > invoke from C++ code. No fancy stuff - just run the whole script with > its parameters. No callbacks, no signalling - nada, just > stupid,primitive, straightforward call. > > And while there is a lot of help on embedding, I coul

Re: Timeline for Python?

2006-09-23 Thread Blair P. Houghton
wesley chun wrote: > > 1. never write against older versions of Python... you will only > obsolete your book even faster (well, "sooner") I believe there is some market for documentation of older versions of software. Many installations are constrained by the cost of upgrading and can not mi

Re: Extended slices and indices

2006-09-23 Thread Robert Kern
[EMAIL PROTECTED] wrote: > The indices method of slice doesn't seem to work quite how I would > expect when reversing a sequence. > > For example : s = '01234' s[::-1] > '43210' s[slice(None,None,-1) ] > '43210' > > So a slice with a negative step (and nothing else) reverses the >

Re: HTTP GET Explodes...

2006-09-23 Thread John Machin
Pete wrote: > I was running the HTTP GET example at > http://www.python.org/doc/current/lib/httplib-examples.html and ran > into a bit of trouble... > > >>> import httplib # This works. > >>> conn = httplib.HTTPConnection("www.python.org") # This works. > >>> conn.request("GET", "/index.html")

Re: webbrowser module's Firefox support

2006-09-23 Thread Dustan
MonkeeSage wrote: > Dustan wrote: > > That didn't work either. > > Well, I'm out of ideas. It's also odd that it was being read as > webbrowser.BackgroundBrowser...whatever that is! It should have been > webbrowser.Mozilla. Thanks anyway; you have helped me tremendously. I'm sure I'll get somewhe

Regular expression confusion

2006-09-23 Thread York
I have two backslash - a. and I want to replace them with one backslash, but I failed: >>> import re >>> a = '' >>> re.sub(r'', '\\', '') Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.3/sre.py", line 143, in sub return _compile(pattern,

Re: HTTP GET Explodes...

2006-09-23 Thread Pete
Fade in to episode II... > ... > This is compiling a *constant* regular expression, and works OK on the > Windows distribution of Python 2.4.3 : H. Here's the version information stuff: Python 2.4.2 (#1, Feb 12 2006, 03:59:46) [GCC 4.1.0 20060210 (Red Hat 4.1.0-0.24)] on linux2 I'm going to

Re: License / Registration key enabled software

2006-09-23 Thread T
Umm...I was hoping for something simpler and more straight forward. Is there a module that would be useful for this type of thing? -- http://mail.python.org/mailman/listinfo/python-list

Re: Extended slices and indices

2006-09-23 Thread GavinCrooks
Robert Kern wrote: > I'd say bug in the .indices() method. The meaning of [4:-1:-1] is unavoidable > different than [::-1] since the index -1 points to the last element, not the > imaginary element before the first element. Unfortunately, there *is* no > concrete (start, stop, step) tuple that wil

Re: Regular expression confusion

2006-09-23 Thread John Machin
York wrote: > I have two backslash - a. and I want to replace them with one backslash, > but I failed: > > >>> import re > >>> a = '' > >>> re.sub(r'', '\\', '') > Traceback (most recent call last): >File "", line 1, in ? >File "/usr/lib/python2.3/sre.py", line 143, in sub >

Re: Extended slices and indices

2006-09-23 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Robert Kern wrote: >> I'd say bug in the .indices() method. The meaning of [4:-1:-1] is unavoidable >> different than [::-1] since the index -1 points to the last element, not the >> imaginary element before the first element. Unfortunately, there *is* no >> concrete (sta

Re: HTTP GET Explodes...

2006-09-23 Thread Pete
> ... > I'm going to upgrade Python and see if that has any effect... > ... I upgraded Python, it had an effect, but not a positive one. My interactivity is below. Where is the "Hello World." text coming from? Python 2.4.3 (#1, Jun 13 2006, 11:46:08) [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linu

Re: HTTP GET Explodes...

2006-09-23 Thread John Machin
Pete wrote: > Fade in to episode II... > > > ... > > This is compiling a *constant* regular expression, and works OK on the > > Windows distribution of Python 2.4.3 : > > H. Here's the version information stuff: > > Python 2.4.2 (#1, Feb 12 2006, 03:59:46) > [GCC 4.1.0 20060210 (Red Hat 4.1.0-

Re: HTTP GET Explodes...

2006-09-23 Thread Pete
John Machin wrote: > Pete wrote: > > Fade in to episode II... > > > > > ... > > > This is compiling a *constant* regular expression, and works OK on the > > > Windows distribution of Python 2.4.3 : > > > > H. Here's the version information stuff: > > > > Python 2.4.2 (#1, Feb 12 2006, 03:59:46)

Re: A critique of cgi.escape

2006-09-23 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Lawrence D'Oliveiro wrote: >> So I think the default for the second argument to cgi.escape should be >> changed to True. Or alternatively, the second argument should be removed >> altogether, and quotes should always be escaped. > > you're con

Re: HTTP GET Explodes...

2006-09-23 Thread John Machin
Pete wrote: > John Machin wrote: > > Pete wrote: > > > Fade in to episode II... > > > > > > > ... > > > > This is compiling a *constant* regular expression, and works OK on the > > > > Windows distribution of Python 2.4.3 : > > > > > > H. Here's the version information stuff: > > > > > > Pytho

What is the best way to "get" a web page?

2006-09-23 Thread Pete
I have the following code: >>> web_page = urllib.urlopen("http://www.python.org";) >>> file = open("temp.html", "w") >>> web_page_contents = web_page.read() >>> file.write(web_page_contents) >>> file.close >>> The file "temp.html" is created, but it doesn't look like the page at www.python.org.

Re: What is the best way to "get" a web page?

2006-09-23 Thread Paul McGuire
"Pete" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have the following code: > web_page = urllib.urlopen("http://www.python.org";) file = open("temp.html", "w") web_page_contents = web_page.read() file.write(web_page_contents) file.close > > > The f

Re: What is the best way to "get" a web page?

2006-09-23 Thread Pete
> >I have the following code: > > > web_page = urllib.urlopen("http://www.python.org";) > file = open("temp.html", "w") > web_page_contents = web_page.read() > file.write(web_page_contents) > file.close > > > > > > > The file "temp.html" is created, but it doesn't loo

Re: Help

2006-09-23 Thread goonmail
wesley chun wrote: > > From: "Rrajal" <[EMAIL PROTECTED]> > > Date: Mon, Sep 18 2006 9:50 am > > Subject: Re: Help > > Groups: comp.lang.python > > > > Hi there, I am new in this subject so could you please tell > > me from where I can get help (or good e-book) of python? Don't forget *the Pytho

Re: returning None instead of value: how to fix?

2006-09-23 Thread George Sakkis
Neil Cerutti wrote: > It's not out of the kindness of our hearts that we help. Heck, I > don't know what it is. Probably I just like reading my own drivel > on the internet and occassionally helping others is a good > excuse. Weird, isn't it ? Good to know that it's not just me that thinks this w

Re: License / Registration key enabled software

2006-09-23 Thread Steven D'Aprano
On Sat, 23 Sep 2006 18:39:58 -0700, T wrote: > > Umm...I was hoping for something simpler and more straight forward. Is > there a module that would be useful for this type of thing? It really helps if you quote the relevant bits of the email you are replying to. Otherwise, people who come along

Re: What is the best way to "get" a web page?

2006-09-23 Thread George Sakkis
Pete wrote: > The file "temp.html" is definitely different than the first run, but > still not anything close to www.python.org . Any other suggestions? If you mean that the page looks different in a browser, for one thing you have to download the css files too. Here's the relevant extract from t

Re: A critique of cgi.escape

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Jon Ribbens wrote: > In article <[EMAIL PROTECTED]>, Fredrik > Lundh wrote: >> Lawrence D'Oliveiro wrote: >>> >>> So I think the default for the second argument to cgi.escape should be >>> changed to True. Or alternatively, the second argument should be removed >>>

Re: grabbing random words

2006-09-23 Thread Steven D'Aprano
On Sat, 23 Sep 2006 04:37:31 -0700, MonkeeSage wrote: > Another approach would be to just scrape a CS's random (5.75 x 10^30) > word haiku generator. ;) That isn't 5.75e30 words, it is the number of possible haikus. There aren't that many words in all human languages combined. Standard English w

Re: HTTP GET Explodes...

2006-09-23 Thread Pete
> > Python 2.4.3 (#1, Jun 13 2006, 11:46:08) > > [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import httplib > > >>> conn = httplib.HTTPConnection("www.python.org") > > >>> conn.request("GET", "/index.html") > >

Re: HTTP GET Explodes...

2006-09-23 Thread Pete
> > Python 2.4.3 (#1, Jun 13 2006, 11:46:08) > > [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import httplib > > >>> conn = httplib.HTTPConnection("www.python.org") > > >>> conn.request("GET", "/index.html") > >

How about assignment to True and False...

2006-09-23 Thread Nick Vatamaniuc
Perhaps it will be addressed in 3.0... I hope True and False could become keywords eventually. That would stop silliness like: - In [1]: False=True In [2]: not False Out[2]: False In [3]: False Out[3]: True - Nick V. John Roth wrote: > Saizan wrote: >

Re: grabbing random words

2006-09-23 Thread Frode
Jay wrote: > How would I be able to grab random words from an internet source. I'd > like to grab a random word from a comprehensive internet dictionary. > What would be the best source and the best way to go about this? Here's a source that gives you a random word: http://www.zokutou.co.uk/rando

Difficulty with maxsplit default value for str.split

2006-09-23 Thread Steven D'Aprano
I'm having problems passing a default value to the maxsplit argument of str.split. I'm trying to write a function which acts as a wrapper to split, something like this: def mysplit(S, sep=None, maxsplit=None): pre_processing() result = S.split(sep, maxsplit) post_processing() retur

Re: grabbing random words

2006-09-23 Thread Nick Vatamaniuc
Jay, Your problem is specific to a particular internet dictionary provider. UNLESS 1) The dictionary page has some specific link that gets you a random word, OR 2) after you click through a couple of word definitions you find in the URLs of the pages that the words are indexed usin

Re: Difficulty with maxsplit default value for str.split

2006-09-23 Thread Nick Vatamaniuc
Steven, According to the current Python source the default value of maxsplit=-1. I think you can count on that as I don't think there would be a reason to change it in the future. If you are really worried about it then your version of calling a particular version of split should work. By the way

Re: Regular expression confusion

2006-09-23 Thread York
Oh, that's right, the second arg is escaped by re compiler too. Thank you, John. York John Machin wrote: > York wrote: > >>I have two backslash - a. and I want to replace them with one backslash, >>but I failed: >> >> >>> import re >> >>> a = '' >> >>> re.sub(r'', '\\', '') >>Trac

<    1   2