Re: ruby -> python translator exists?

2008-12-26 Thread Banibrata Dutta
http://github.com/why/unholy/tree/master On Sat, Dec 27, 2008 at 11:19 AM, rogerdpack wrote: > > Search for the tool "Unholy". -- Al > > Thank you for your replies. > -=r > -- > http://mail.python.org/mailman/listinfo/python-list > -- regards, Banibrata http://www.linkedin.com/in/bdutta http:

Re: ruby -> python translator exists?

2008-12-26 Thread rogerdpack
> Search for the tool "Unholy". -- Al Thank you for your replies. -=r -- http://mail.python.org/mailman/listinfo/python-list

Re: raw_input can't handle pound sign?

2008-12-26 Thread Jugdish
Ahh ok, tried out your example and it works just fine. Turns out the actual problem is what I was doing with the input. Elsewhere, I call urlparse.urlparse() on the filename past in, which splits up the filename where the # sign is, so that's why it looked to me like the characters after the # were

Re: How to display Chinese in a list retrieved from database via python

2008-12-26 Thread zxo102
On 12月26日, 下午3时16分, "Mark Tolonen" wrote: > "zxo102" wrote in message > > news:979fdf6d-0500-47ba-87fd-0f0361ca3...@p2g2000prf.googlegroups.com... > > > > > > > On 12月26日, 上午4时58分, "Gabriel Genellina" > > wrote: > >> En Thu, 25 Dec 2008 07:27:03 -0200, zxo102 escribió: > > >> > On 12月25日, 下午3时3

Re: raw_input can't handle pound sign?

2008-12-26 Thread Steven D'Aprano
On Fri, 26 Dec 2008 20:20:16 -0800, Jugdish wrote: > Hi, I'm having problems getting a pound sign to go through as input sent > to the raw_input() command. I'm running Python 2.5.1 on Windows XP. > Here's my simple little script: > > while True: > response = raw_input("Please enter a file nam

raw_input can't handle pound sign?

2008-12-26 Thread Jugdish
Hi, I'm having problems getting a pound sign to go through as input sent to the raw_input() command. I'm running Python 2.5.1 on Windows XP. Here's my simple little script: while True: response = raw_input("Please enter a file name: ") if os.path.exists(response): break Problem is

Re: SyntaxError: encoding problem: with BOM

2008-12-26 Thread NoName
On 26 дек, 23:08, "Gabriel Genellina" wrote: > En Thu, 25 Dec 2008 11:55:16 -0200, NoName escribió: > > > Error > > > > C:\Documents and Settings\Ra\Рабочий стол>11.py > > File "", line 1 > > SyntaxError: encoding problem: with BOM > > > No error > > > > C:\Documents and Settings\Ra\Р

Re: math.sqrt() in new 3.0 version : solution in input()

2008-12-26 Thread John Machin
On Dec 27, 1:34 pm, David Lemper wrote: > > Problem is the new input() function. Yields a string. > > Thanks to Scott, Chris, Gabriel & John. > > Some thought I was not using the Python 3 command line. > I was :  Python 3.0 (r30:67507... > Erratic behavior was that I was sometimes using n = input()

Re: Is there a function to remove escape characters from a string ?

2008-12-26 Thread Steven D'Aprano
On Sat, 27 Dec 2008 01:41:40 +0100, Stef Mientki wrote: > Sorry if I offended someone, that was certainly not my intention. And I > guess you will be surprised, if I tell you, I don't (want) to understand > any bit of the above code ;-) Come on, the home computer was invented > about 1980. If we l

Re: math.sqrt() in new 3.0 version : solution in input()

2008-12-26 Thread Steven D'Aprano
On Fri, 26 Dec 2008 20:34:45 -0600, David Lemper wrote: > On Fri, 26 Dec 2008 15:52:24 -0600, David Lemper wrote: > >>At the command line this function works correctly >> >>> import math >> n = input("enter a number > ") >> s = math.sqrt(n) >> An entry of 9 or 9

Re: math.sqrt() in new 3.0 version : solution in input()

2008-12-26 Thread David
On Fri, 26 Dec 2008 15:52:24 -0600, David Lemper wrote: >At the command line this function works correctly > >>> import math > n = input("enter a number > ") > s = math.sqrt(n) > An entry of 9 or 9.0 will yield 3.0 > >Yet the same code in a script gives an erro

Re: ruby -> python translator exists?

2008-12-26 Thread Al Snow
On Dec 26, 8:31 pm, bearophileh...@lycos.com wrote: > rogerdpack: > > > Hi all.  My name is Roger. > > Hello Roger, my name is bearophile. > > > Anybody know of a Ruby -> Python translator at all?  I'm looking for a > > way to have my Ruby code take advantage of the coolio speed of Psyco. > > I hav

Re: ruby -> python translator exists?

2008-12-26 Thread bearophileHUGS
rogerdpack: > Hi all.  My name is Roger. Hello Roger, my name is bearophile. > Anybody know of a Ruby -> Python translator at all?  I'm looking for a > way to have my Ruby code take advantage of the coolio speed of Psyco. I have never heard of such translator, so far. > Also question. Does p

Re: multiply each element of a list by a number

2008-12-26 Thread Brian Blais
On Dec 26, 2008, at 19:05 , robert.t.ly...@seagate.com wrote: but this seems overkill to me. Can you tell I am coming to Python from Matlab? if you're coming from matlab, then you should think of python lists more like cell arrays than matrices: you can have lists of arbitrary data type

Re: online money earnings

2008-12-26 Thread kather
Classical program and new investment programs . Join here : Paying : http://www.geniusfunds.com/?c=501251 http://www.geniusfunds.com/ Seem not bad : http://www.forexinv.net/?refer=jhon1092 http://www.forexinv.net/ -- View this message in context: http://www.nabble.com/online-money-earnings-t

Re: Process with ftplib

2008-12-26 Thread nemo
On Dec 26, 10:40 pm, "Gabriel Genellina" wrote: > En Fri, 26 Dec 2008 11:07:30 -0200, nemo escribió: > > > There seems something wrong when I use multiprocessing.Process with > > ftplib, [...] > > It works well but when I using the Process module, something seems > > wrong: > > ftp = qftp(host, p

Re: Doing set operation on non-hashable objects

2008-12-26 Thread 5lvqbwl02
On Dec 24, 12:52 pm, Carl Banks wrote: > On Dec 24, 1:16 pm, 5lvqbw...@sneakemail.com wrote: > > > > > > > Hi, > > > I'm writing an application which is structured roughly as follows: > > > "db" is a dict, where the values are also dicts. > > A function searches through db and returns a list of va

Re: multiply each element of a list by a number

2008-12-26 Thread Martin
you might also want to look into the map(elem), and filter(elem) builtins >>> def multby3(elem): ... return elem * 3 ... >>> map(multby3, (1, 2, 3, )) [3, 6, 9] >>> help(map) >>> def even(elem): ... return not elem % 2 ... >>> filter(even, (1, 2, 3, )) (2,) >>> help(filter) KeyboardInterr

ruby -> python translator exists?

2008-12-26 Thread rogerdpack
Hi all. My name is Roger. Anyway question. Anybody know of a Ruby -> Python translator at all? I'm looking for a way to have my Ruby code take advantage of the coolio speed of Psyco. Also question. Does psyco work with Python 3.0? Thanks! -=r -- http://mail.python.org/mailman/listinfo/python-lis

SVG & Canvas: Graphics for the Web

2008-12-26 Thread Tokyo Dan
Is there a Python library that can draw/write graphics to web browsers vis SVG & Canvas via some kind of Python to javascript translation/ compilation? -- http://mail.python.org/mailman/listinfo/python-list

Re: multiply each element of a list by a number

2008-12-26 Thread Scott David Daniels
Tim Chase wrote: What does *not* work is 3 * [0,1,2] As you know, this gives [0,1,2,0,1,2,0,1,2] What I am hoping for is [0,3,6] I see that I can use numpy.multiply(3,range(3)) The common way to do this is just a1 = [0,1,2] a2 = [x * 3 for x in a1] ... But a

Re: multiply each element of a list by a number

2008-12-26 Thread Tim Chase
What does *not* work is 3 * [0,1,2] As you know, this gives [0,1,2,0,1,2,0,1,2] What I am hoping for is [0,3,6] I see that I can use numpy.multiply(3,range(3)) but this seems overkill to me. Can you tell I am coming to Python from Matlab? The common way to do

Re: Right way to set a variable to NULL?

2008-12-26 Thread John Machin
On Dec 27, 11:05 am, Martin wrote: > 2008/12/26 John Machin : > > > The above all have the same characteristic: if the input is a zero- > > length string, then NULL is inserted into the database instead of a > > zero-length string. Some folks (not just pedants!) regard that as an > > important dif

Re: multiply each element of a list by a number

2008-12-26 Thread Benjamin Kaplan
On Fri, Dec 26, 2008 at 7:05 PM, wrote: > > What does *not* work is > 3 * [0,1,2] > As you know, this gives > [0,1,2,0,1,2,0,1,2] > What I am hoping for is > [0,3,6] > I see that I can use > numpy.multiply(3,range(3)) > but this seems overkill to me. Can you tell

Re: Is there a function to remove escape characters from a string ?

2008-12-26 Thread Stef Mientki
John Machin wrote: On Dec 27, 12:05 am, Stef Mientki wrote: Yep, chr(254), because it's not in the human range of characters and it's accepted by windows ini-files. import unicodedata as ucd for i in (0,1,2,3,4,7,8): ...s = chr(254) ...enc = 'cp125' + str(i) ...

multiply each element of a list by a number

2008-12-26 Thread Robert . T . Lynch
What does *not* work is 3 * [0,1,2] As you know, this gives [0,1,2,0,1,2,0,1,2] What I am hoping for is [0,3,6] I see that I can use numpy.multiply(3,range(3)) but this seems overkill to me. Can you tell I am coming to Python from Matlab? Thanks -- Rob-- http://

Re: Python 3 and my Mac (Leopard)

2008-12-26 Thread Martin v. Löwis
Dan wrote: > Is the python community just not interested in Macs? This is fairly close to the truth. The Mac port is currently mostly unmaintained, due to the past contributors having moved on or being occupied by other matters (such as Real Life). I would phrase it vice versa, though: the Mac

Re: Right way to set a variable to NULL?

2008-12-26 Thread Martin
2008/12/26 John Machin : > The above all have the same characteristic: if the input is a zero- > length string, then NULL is inserted into the database instead of a > zero-length string. Some folks (not just pedants!) regard that as an > important difference. agreed but I understood the OP specifi

Re: Is there a function to remove escape characters from a string ?

2008-12-26 Thread John Machin
On Dec 27, 12:05 am, Stef Mientki wrote: > Yep, chr(254), because it's not in the human range of characters > and it's accepted by windows ini-files. >>> import unicodedata as ucd >>> for i in (0,1,2,3,4,7,8): ...s = chr(254) ...enc = 'cp125' + str(i) ...try: ... u = s.decode(e

Re: strange behavior of math.sqrt() in new 3.0 version

2008-12-26 Thread John Machin
On Dec 27, 8:52 am, David Lemper wrote: > I'm a newbee trying 3.0   Please help with  math.sqrt() math.sqrt() is not the problem. > At the command line this function works correctly >       >>> import math >               n = input("enter a number > ") >               s = math.sqrt(n) >      An e

looking for a consultant for the design of an interface for our mathematical models

2008-12-26 Thread Marko Loparic
Hi, I am looking for someone that could help us to design (perhaps also to implement) a user interface (GUI + repository of data) for our mathematical models. I work for a company in the energy sector. Currently in our department we have 5 different mathematical models using different GUIs and ex

Re: strange behavior of math.sqrt() in new 3.0 version

2008-12-26 Thread Gabriel Genellina
En Fri, 26 Dec 2008 19:52:24 -0200, escribió: I'm a newbee trying 3.0 Please help with math.sqrt() At the command line this function works correctly >>> import math n = input("enter a number > ") s = math.sqrt(n) An entry of 9 or 9.0 will yield 3.0 Y

Re: strange behavior of math.sqrt() in new 3.0 version

2008-12-26 Thread Chris Rebert
On Fri, Dec 26, 2008 at 1:52 PM, wrote: > I'm a newbee trying 3.0 Please help with math.sqrt() > > At the command line this function works correctly > >>> import math > n = input("enter a number > ") raw_input() was renamed input() in Python 3.0, and it returns a *string*, n

Re: strange behavior of math.sqrt() in new 3.0 version

2008-12-26 Thread Scott David Daniels
David Lemper wrote: I'm a newbee trying 3.0 Please help with math.sqrt() At the command line this function works correctly >>> import math n = input("enter a number > ") s = math.sqrt(n) An entry of 9 or 9.0 will yield 3.0 Yet the same code in a sc

Re: Right way to set a variable to NULL?

2008-12-26 Thread John Machin
On Dec 27, 8:16 am, Scott David Daniels wrote: > Martin wrote: > > ... > > class MailAddress(object): > >   def __init__(self, address=None): > >     self.address = address > >   def __str__(self): > >     if address: > >       return self.adress > >     return "NULL" > > There is an obvious typo

Python and DomainKey

2008-12-26 Thread nicolas . delanos
Hello, I'm working on a script able to send email using DomainKey and DKIM. For DKIM, it's working well (Thanks Greg - pydkim) but with DomainKey, I have trouble. There is no library yet able to sign emails. I tried to modify the pydkim library to implement DK but everything I have a "sig fail".

strange behavior of math.sqrt() in new 3.0 version

2008-12-26 Thread David
I'm a newbee trying 3.0 Please help with math.sqrt() At the command line this function works correctly >>> import math n = input("enter a number > ") s = math.sqrt(n) An entry of 9 or 9.0 will yield 3.0 Yet the same code in a script gives an error mess

Re: Right way to set a variable to NULL?

2008-12-26 Thread John Machin
On Dec 27, 7:33 am, Gilles Ganault wrote: > Hello > > I use regexes to extract information from a text file. Some of the > records don't have e-mails or www addresses, so those must match Null > in SQL, but None doesn't work as expected: > > === >         if itemmatch: >                 web =

Re: [SQL] Right way to set a variable to NULL?

2008-12-26 Thread Scott David Daniels
Martin wrote: ... class MailAddress(object): def __init__(self, address=None): self.address = address def __str__(self): if address: return self.adress return "NULL" There is an obvious typo above: > if address: should be: if self.address: Or, you could replace

Re: [SQL] Right way to set a variable to NULL?

2008-12-26 Thread Steve Holden
Gilles Ganault wrote: > Hello > > I use regexes to extract information from a text file. Some of the > records don't have e-mails or www addresses, so those must match Null > in SQL, but None doesn't work as expected: > > === > if itemmatch: > web = itemmatch.group(1).stri

Re: [SQL] Right way to set a variable to NULL?

2008-12-26 Thread Martin
Hi, I'd create a simple wrapper object class MailAddress(object): def __init__(self, address=None): self.address = address def __str__(self): if address: return self.adress return "NULL" you can keep most of your code just replace the original instantiation of the mail str-

[SQL] Right way to set a variable to NULL?

2008-12-26 Thread Gilles Ganault
Hello I use regexes to extract information from a text file. Some of the records don't have e-mails or www addresses, so those must match Null in SQL, but None doesn't work as expected: === if itemmatch: web = itemmatch.group(1).strip() else: we

Re: I always wonder ...

2008-12-26 Thread r
On Dec 26, 5:06 am, pdora...@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) wrote: > r wrote: > > > Go to Google groups... it looks perfect :) > > It's a usenet group here, nothing to do with google groups. > To get back to the group subject, what is your actual python projects ? I am crusading

Re: Can´t Surf Python Pages in Windoze

2008-12-26 Thread Gabriel Genellina
En Fri, 26 Dec 2008 15:11:44 -0200, Victor Subervi escribió: On 12/26/08, Tino Wildenhain wrote: print "Content-Type: text/html" print print """ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> I think there should be only one blank line between header and content, you have two (so

Re: Can´t Surf Python Pages in Windoze

2008-12-26 Thread Gabriel Genellina
En Fri, 26 Dec 2008 15:11:44 -0200, Victor Subervi escribió: On 12/26/08, Tino Wildenhain wrote: print "Content-Type: text/html" print print """ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> I think there should be only one blank line between header and content, you have two (so

Re: Can´t Surf Python Pages in Windoze

2008-12-26 Thread Victor Subervi
On 12/26/08, Tino Wildenhain wrote: > > > print "Content-Type: text/html" >> print >> print """ >> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> >> http://www.w3.org/1999/xhtml"; xml:lang="en"> >> >> >> >> Yeah >> >> """ >> > > this could be fine if called in CGI context. Can you st

Re: tkinter 3.0 multiple keyboard events together

2008-12-26 Thread Pavel Kosina
janislaw napsal(a): On 26 Gru, 05:52, Pavel Kosina wrote: Is it possible to catch in an event more that one key from keyboard? In my code, I can handle always the only one, the first I press, the others are omitted. Say, I press both "4" and "8" and only "4" is catched. def movePlayer(event

Re: sys.stdout.write()'s bug or doc bug?

2008-12-26 Thread Martin
Sorry GMAIL got me again, I sent this in private first, apologies. hi, 2008/12/26 Qiangning Hong : sys.stdout.write(u) > Traceback (most recent call last): > File "", line 1, in > UnicodeEncodeError: 'ascii' codec can't encode character u'\u554a' in > position 0: ordinal not in range(128

Re: Can´t Surf Python Pages in Windoz e

2008-12-26 Thread Tino Wildenhain
hi, Victor Subervi wrote: Hi; I try to surf to this code in Windoze and it doesn't work...just posts a small, black screen for a split second. Why? I don't know what "surf this code" means (or what Windoze should be) print "Content-Type: text/html" print print """ "http://www.w3.org/TR/xht

Can´t Surf Python Pages in Windoze

2008-12-26 Thread Victor Subervi
Hi; I try to surf to this code in Windoze and it doesn't work...just posts a small, black screen for a split second. Why? print "Content-Type: text/html" print print """ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en"> Yeah """ Also, Zope is i

Re: Process with ftplib

2008-12-26 Thread Gabriel Genellina
En Fri, 26 Dec 2008 11:07:30 -0200, nemo escribió: There seems something wrong when I use multiprocessing.Process with ftplib, [...] It works well but when I using the Process module, something seems wrong: ftp = qftp(host, port, user, password) p = multiprocessing.Process(target = ftp.connect)

Re: [2.5.1] Str.Replace() doesn't work?

2008-12-26 Thread Gilles Ganault
On Fri, 26 Dec 2008 15:16:49 +0100, Gilles Ganault wrote: >I can't figure out why the script is not returning anything in the >"for m in matches" block: Pfff, found it 5mn after posting ;-) s/reponse =/response =/ Sorry guys. -- http://mail.python.org/mailman/listinfo/python-list

[2.5.1] Str.Replace() doesn't work?

2008-12-26 Thread Gilles Ganault
Hello I need to parse an HTML file where records aren't homogenous, so I figured I could run a first loop to add an unused character at the beginning of each record, and then run a second loop to actually parse each record. I can't figure out why the script is not returning anything in th

Re: Socket recv function taking longer time

2008-12-26 Thread Gabriel Genellina
En Fri, 26 Dec 2008 11:36:15 -0200, escribió: I have designed a recieving system in C. I have used the sockets recv function. The problem I m facing is that the sending system does not wait for the ACK(the amount of time it waits 4 the Ack is too less as the recv takes more time to read th

Socket recv function taking longer time

2008-12-26 Thread reachrekhakn
Hi, I have designed a recieving system in C. I have used the sockets recv function. The problem I m facing is that the sending system does not wait for the ACK(the amount of time it waits 4 the Ack is too less as the recv takes more time to read the msg), it keeps on sending the same msg agai

Re: Easy-to-use Python GUI

2008-12-26 Thread Peter Decker
On Thu, Dec 25, 2008 at 1:46 AM, Gabriel Genellina wrote: > En Wed, 24 Dec 2008 21:47:07 -0200, Joel Koltner > escribió: > >> Is there an easy-to-use, "function"-based cross-platform GUI toolkit for >> Python out there that's a little more sophisticated than EasyGui? > > Try Dabo http://dabodev.c

Process with ftplib

2008-12-26 Thread nemo
Hi,all There seems something wrong when I use multiprocessing.Process with ftplib, My ftp class has a connection method like this: class qftp: def __init__(...): self.ftp = FTP() def connection(self): self.ftp.connect(self.addr, self.port) self.ftp.login(self.user, s

Re: Is there a function to remove escape characters from a string ?

2008-12-26 Thread Stef Mientki
I have the following kind of strings, the funny "þ" is ASCII character 254, used as a separator character ASCII ends at 127. Just refer to it as chr(254). note 1) [FSM] Counts = "1þ11þ16" ==> 1,11,16 Init1 = "1þ\BCtrl" ==>1,Ctrl State5 = "8þ\BJUMP_COMPL\b\n>PCWrite = 1

Re: Exec inside a class method to call other class methods?

2008-12-26 Thread Gabriel Genellina
En Fri, 26 Dec 2008 03:59:25 -0200, Carl Banks escribió: To be honest I am a little concerned over the more-or-less knee-jerk suggestions to refactor this into a highly object-oriented approach. For the task at hand the OP's approach is fine (aside from the use of exec). Yep. There is a sim

Re: SyntaxError: encoding problem: with BOM

2008-12-26 Thread Gabriel Genellina
En Thu, 25 Dec 2008 11:55:16 -0200, NoName escribió: Error C:\Documents and Settings\Ra\Рабочий стол>11.py File "", line 1 SyntaxError: encoding problem: with BOM No error C:\Documents and Settings\Ra\Рабочий стол>python 11.py test Error when russian symbols in full path to py-scr

Re: I always wonder ...

2008-12-26 Thread Pierre-Alain Dorange
r wrote: > > Go to Google groups... it looks perfect :) It's a usenet group here, nothing to do with google groups. To get back to the group subject, what is your actual python projects ? -- Pierre-Alain Dorange Ce message est sous licence Creative Commons "by-nc-sa-2.0"

Re: tkinter 3.0 multiple keyboard events together

2008-12-26 Thread janislaw
On 26 Gru, 05:52, Pavel Kosina wrote: > Is it possible to catch in an event more that one key from keyboard? In > my code, I can handle always the only one, the first I press, the others > are omitted. Say, I press both "4" and "8" and only "4" is catched. > > def movePlayer(event): >     print (e