RIse and fall of languages in 2012

2013-01-09 Thread Steven D'Aprano
"In general-purpose scripting languages, Python continues to grow slowly, JavaScript and Ruby are treading water, and Perl continues its long decline. According to Google trends, the number of searches for Perl is 19% of what it was in 2004. Its declining role in open-source communities further

How to run multiline shell command within python

2013-01-09 Thread Karim
Hello all, I want to run multiline shell command within python without using a command file but directly execute several lines of shell. I already use *subprocess.checkoutput("csh -f my_file.csh".split())* but I want to know if it is posssible to avoid making file and execute shell lines of

Re: subprocess.Popen and multiprocessing fails to execute external program

2013-01-09 Thread Dave Angel
On 01/09/2013 11:08 PM, Niklas Berliner wrote: > I have a pipline that involves processing some data, handing the data to an > external program (t_coffee used for sequence alignments in bioinformatics), > and postprocessing the result. Since I have a lot of data, I need to run my > pipeline in para

Re: Getting audio input and processing it?

2013-01-09 Thread Dave Angel
On 01/09/2013 07:20 PM, Michael Curry wrote: > I've been working on a Morse Code translator, I've made it work so that you > can input English and it will translate it to Morse and play the Audio. I now > want to add a feature to the program that takes audio input, processes it and > then output

subprocess.Popen and multiprocessing fails to execute external program

2013-01-09 Thread Niklas Berliner
I have a pipline that involves processing some data, handing the data to an external program (t_coffee used for sequence alignments in bioinformatics), and postprocessing the result. Since I have a lot of data, I need to run my pipeline in parallel which I implemented using the multiprocessing modu

Re: How to call wget by python ?

2013-01-09 Thread rurpy
On Wednesday, January 9, 2013 7:11:34 PM UTC-7, iMath wrote: > can you give me an example code ? For running any system command from Python, you can use the subprocess module: http://docs.python.org/3/library/subprocess.html#module-subprocess To run "wget -p -k http://python.org"; from Python

Re: how to download internet files by python ?

2013-01-09 Thread Tim Roberts
iMath wrote: > >There is also a httplib2 module >https://code.google.com/p/httplib2/ > >which one is more pythonic and powerful ? Both are Pythonic, and power is irrelevant for this. Your code is going to spend 90% of its time waiting for the network. Just solve the problem. -- Tim Roberts, t

Re: How to call wget by python ?

2013-01-09 Thread Steven D'Aprano
On Wed, 09 Jan 2013 18:11:34 -0800, iMath wrote: > can you give me an example code ? Is the web broken where you are? If you google for "python wget", you will find example of how to call wget as an external process, as well as examples of downloading files from the web like wget would do but

Re: How to call wget by python ?

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 2:21 PM, 8 Dihedral wrote: > Inherantly the python interpreter has a GC builtin > to use pacakages like DLL by reference counting. That almost makes sense. And it's almost profound, too. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: How to call wget by python ?

2013-01-09 Thread 88888 Dihedral
Michael Torrie於 2013年1月10日星期四UTC+8上午11時04分31秒寫道: > On 01/09/2013 07:11 PM, iMath wrote: > > > can you give me an example code ? > > > > No but I can suggest some alternative ideas, such as using httplib > > (built into python), or libcurl. Or if you have to use wget, you run it > > the same

Re: Class confusion

2013-01-09 Thread Matt Jones
Does this look sufficient for what? You haven't actually told us what it is you're trying to accomplish. I gave you the "how", you must supply the "why". *Matt Jones* On Wed, Jan 9, 2013 at 6:43 PM, Rodrick Brown wrote: > Can anyone care to advise on the following? Based on the responses does

Re: How to call wget by python ?

2013-01-09 Thread Michael Torrie
On 01/09/2013 07:11 PM, iMath wrote: > can you give me an example code ? No but I can suggest some alternative ideas, such as using httplib (built into python), or libcurl. Or if you have to use wget, you run it the same way you run any external command from python. If it were my I'd plunk a fe

Re: new to python and programming at large.

2013-01-09 Thread Michael Torrie
On 01/09/2013 07:45 PM, kwakukwat...@gmail.com wrote: > thanks so much it worked.I have tried and tried.look at what I was doing. > me = raw_input("Enter a value:") > from math import sqrt > def squareroot(y): > > me = squareroot(y) > return squareroot(y) Congratulations! You've just cre

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 09:20:10 PM EST, andydtay...@gmail.com wrote: Thanks for your help guys. I was actually doing a few things wrong, but I have got this script to work by declaring fields as varchar and all values as strings. But I would like to log journey time values in hours/minutes, so I w

Re: How to implement mouse gesture by python or pyqt ?

2013-01-09 Thread iMath
在 2013年1月10日星期四UTC+8上午8时06分13秒,Michael Torrie写道: > On 01/08/2013 07:57 PM, iMath wrote: > > > 在 2013年1月8日星期二UTC+8上午8时44分20秒,iMath写道: > > >> It would be better to give me some examples .thanks in advance ! > > >> > > >> > > >> > > >> P.S. which module or lib are needed ? > > > > > > what

Re: How to call wget by python ?

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 1:11 PM, iMath wrote: > can you give me an example code ? > -- > http://mail.python.org/mailman/listinfo/python-list You've asked several very vague questions. I would strongly recommend that you read this: http://www.catb.org/esr/faqs/smart-questions.html Invoking wget

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Thanks for your help guys. I was actually doing a few things wrong, but I have got this script to work by declaring fields as varchar and all values as strings. But I would like to log journey time values in hours/minutes, so I will have to look into the following: 1. Retrieving this data from

How to call wget by python ?

2013-01-09 Thread iMath
can you give me an example code ? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to download internet files by python ?

2013-01-09 Thread iMath
在 2013年1月8日星期二UTC+8下午1时04分54秒,Roy Smith写道: > In article , > > Cameron Simpson wrote: > > > > > On 07Jan2013 20:19, iMath wrote: > > > | for example ,if I want to download this file ,how to implement the > > download > > > | functionality by python ? > > > | > > > | http://down.51voa.c

Re: How to get the selected text of the webpage in chrome through python ?

2013-01-09 Thread iMath
在 2013年1月9日星期三UTC+8下午5时35分15秒,Alister写道: > On Mon, 07 Jan 2013 20:20:28 -0800, iMath wrote: > > > > > How to get the selected text of the webpage in chrome through python ? > > > > i think you need to explain your requirement further > > also what do you want to do to the text once you have

Re: Why BOM in logging message?

2013-01-09 Thread Roy Smith
In article , Chris Angelico wrote: > On Thu, Jan 10, 2013 at 9:54 AM, Roy Smith wrote: > > What's weird is that two of the servers, and only those two, stick a > > BOM (Byte Order Mark) in front of the message they log. > > Could it be this issue you're looking at? > > http://bugs.python.org/

Re: Why BOM in logging message?

2013-01-09 Thread Roy Smith
In article , John Gordon wrote: > In r...@panix.com (Roy Smith) writes: > > > What's weird is that two of the servers, and only those two, stick a > > BOM (Byte Order Mark) in front of the message they log. It shows up > > in syslog as: > > > 2013-01-09T00:00:00+00:00 web5.songza.com 2013-01

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread MRAB
On 2013-01-10 00:19, andydtay...@gmail.com wrote: Hi John, He're the code I would like to see work. The cursor_to is an oversight. I extracted this element from some other code in an attempt to isolate/resolve the problem myself, hence having a simplified table version. Which works actually,

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 07:19:10 PM EST, andydtay...@gmail.com wrote: Hi John, He're the code I would like to see work. The cursor_to is an oversight. I extracted this element from some other code in an attempt to isolate/resolve the problem myself, hence having a simplified table version. Which wo

Re: Class confusion

2013-01-09 Thread Rodrick Brown
Can anyone care to advise on the following? Based on the responses does this look sufficient? #!/opt/local/bin/python class SystemList(object): sysmap = { '1039' : 'nebula', '1040' : 'mercury'} def __init__(self, sysid): self.sysid = sysid def get_sysname(self

Getting audio input and processing it?

2013-01-09 Thread Michael Curry
I've been working on a Morse Code translator, I've made it work so that you can input English and it will translate it to Morse and play the Audio. I now want to add a feature to the program that takes audio input, processes it and then outputs the English. Are there any specific APIs that I ca

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Hi John, He're the code I would like to see work. The cursor_to is an oversight. I extracted this element from some other code in an attempt to isolate/resolve the problem myself, hence having a simplified table version. Which works actually, but unfortunately that's not educating me suffiecien

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread John Gordon
In andydtay...@gmail.com writes: > I'm a bit stuck on this "INSERT INTO" syntax error. I have no idea why it's What syntax error? It's always helpful if you can post the actual error message. > not working actually... I've tried changing column types to char but that > didn't work. I've gone

Re: pylint or similar to test version-specific language constructs?

2013-01-09 Thread Gisle Vanem
"jkn" wrote: I have to write python code which must run on an old version of python (v2.4) as well as a newer (v2.7). I am using pylint and would like to check if is possible to check with pylint the use of operators etc. which are not present in 2.4; the ternary operator springs to mind.

Re: How to implement mouse gesture by python or pyqt ?

2013-01-09 Thread Michael Torrie
On 01/08/2013 07:57 PM, iMath wrote: > 在 2013年1月8日星期二UTC+8上午8时44分20秒,iMath写道: >> It would be better to give me some examples .thanks in advance ! >> >> >> >> P.S. which module or lib are needed ? > > what I wanna perhaps like this: when a right mouse button is pressed > and we go down and right

Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Hi, I'm a bit stuck on this "INSERT INTO" syntax error. I have no idea why it's not working actually... I've tried changing column types to char but that didn't work. I've gone a bit blind looking at it, but hopefully you can set me right. With the '#'d out lines instead the file does work. Wh

Re: Best way to do this? List loop (matrix?) iteration

2013-01-09 Thread Dave Angel
On 01/09/2013 06:24 PM, andydtay...@gmail.com wrote: > Thanks for your help - this is what I did - though it's probably obvious to > most people reading this. > >for rowcount in range (0, stn_count): > row_durations.append(stn_list_short[rowcount]) > for colcount in range (0, stn_c

pylint or similar to test version-specific language constructs?

2013-01-09 Thread jkn
Hi all I have to write python code which must run on an old version of python (v2.4) as well as a newer (v2.7). I am using pylint and would like to check if is possible to check with pylint the use of operators etc. which are not present in 2.4; the ternary operator springs to mind. I haven't

Re: socket.makefile raises ValueError when mode = 'rt'

2013-01-09 Thread Terry Reedy
On 1/9/2013 9:14 AM, Antoon Pardon wrote: Op 01/09/13 14:54, Dave Angel schreef: On 01/09/2013 08:22 AM, Antoon Pardon wrote: This is using python 3.2. ... But the documentation states: socket.makefile(mode='r', buffering=None, *, encoding=None, errors=None, newline=None) Return a file o

Re: Best way to do this? List loop (matrix?) iteration

2013-01-09 Thread andydtaylor
Thanks for your help - this is what I did - though it's probably obvious to most people reading this. for rowcount in range (0, stn_count): row_durations.append(stn_list_short[rowcount]) for colcount in range (0, stn_count): # 3. Determine Station pairs for API query

Re: Why BOM in logging message?

2013-01-09 Thread John Gordon
In r...@panix.com (Roy Smith) writes: > What's weird is that two of the servers, and only those two, stick a > BOM (Byte Order Mark) in front of the message they log. It shows up > in syslog as: > 2013-01-09T00:00:00+00:00 web5.songza.com 2013-01-0900:00:00,754 > [18979]: [etc...] I worked on

Re: Why BOM in logging message?

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 9:54 AM, Roy Smith wrote: > What's weird is that two of the servers, and only those two, stick a > BOM (Byte Order Mark) in front of the message they log. Could it be this issue you're looking at? http://bugs.python.org/issue14452 What are the exact Python versions in us

Re: Interpolating/crossfading a stack of matrices

2013-01-09 Thread Oscar Benjamin
On 9 January 2013 16:02, wrote: > Hi, > > I want to interpolate (with quadratic splines) a stack of 2D-arrays/matrices > y1, y2, y3, ... in a third dimension (which I call x) e.g. for crossfading > images. I already have a working code which unfortunately still contains two > explicit loops ov

Why BOM in logging message?

2013-01-09 Thread Roy Smith
We've got 10 (supposedly) identical servers, all running Ubuntu 12.04, Python 2.7, Django 1.3. We log to syslog using the logging module and a custom fomatter. 'formatters': { 'verbose': { 'format': '%(asctime)s [%(process)d]: %(program)s %(session_id)s %(requ

Re: Class confusion

2013-01-09 Thread Rodrick Brown
On Wed, Jan 9, 2013 at 4:34 PM, Matt Jones wrote: > # Something like... > > class SystemList(object): >def get_systemid(self): > return "System Id: bleh" > >def get_running_kernel(self): > return "Kernel: bleh" > > > class SatelliteConnect(object): >def get_systemlist(self)

Re: ANN: PyDTLS

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 7:04 AM, rbit wrote: > The following are some of the main use cases that force applications into > datagram protocols: > > * Minimizing protocol overhead. TCP has relatively high overhead, > for example, its 3-way handshake for connection establishment. > On

Re: Class confusion

2013-01-09 Thread Matt Jones
# Something like... class SystemList(object): def get_systemid(self): return "System Id: bleh" def get_running_kernel(self): return "Kernel: bleh" class SatelliteConnect(object): def get_systemlist(self): return SystemList() # Now the code you wrote would work, only

Re: Class confusion

2013-01-09 Thread MRAB
On 2013-01-09 20:13, Rodrick Brown wrote: How can I make a class that has methods with attributes and other functions? I see a lot of code I'm reading the documentation to Redhat's Satellite software which has a XMLRPC interface and wrote the following code to test the api. I would like to ext

Re: new to python and programming at large.

2013-01-09 Thread kwakukwatiah
-Original Message- From: Dave Angel Sent: Wednesday, January 09, 2013 12:00 PM To: python-list@python.org Subject: Re: new to python and programming at large. On 01/09/2013 05:28 PM, kwakukwat...@gmail.com wrote: thanks for ur help I wz able to do it.but I wish to expand it by asking

paralell ftp uploads and pool size

2013-01-09 Thread ben
Hello, I have a python script that uploads multiple files from the local machine to a remote server in parallel via ftp using p process pool: p = Pool(processes=x) Now as I increase the value of x, the overall upload time for all files drops as expected. If I set x too high however, then an e

Class confusion

2013-01-09 Thread Rodrick Brown
How can I make a class that has methods with attributes and other functions? I see a lot of code I'm reading the documentation to Redhat's Satellite software which has a XMLRPC interface and wrote the following code to test the api. I would like to extend this code to support methods with metho

Re: ANN: PyDTLS

2013-01-09 Thread rbit
Neal, A network protocol that is unreliable (i.e., lacks retransmission of dropped packets) and lacks congestion control will certainly never be a common, general purpose protocol, due to the amount of work it imposes on its user. Implementing an AIMD congestion control algorithm is burdensome to

Re: How to modify this script?

2013-01-09 Thread chaouche yacine
Indeed, the console shows a traceback where data is misinterpreted, maybe due to my triple protective quotes around $GEDIT_SELECTED_TEXT. Try without them, like so (it worked for me) : $< def addline(line):     return "%s\n" % line def addcolumn(item,nb_columns):     if nb_columns != 3:   

Re: new to python and programming at large.

2013-01-09 Thread Dave Angel
On 01/09/2013 05:28 PM, kwakukwat...@gmail.com wrote: > thanks for ur help I wz able to do it.but I wish to expand it by asking a > user to input a number for the sqrt to be calculated it I dd it this way but > its not working. > > > from math import sqrt > number = raw_input('enter a number:') >

Re: new to python and programming at large.

2013-01-09 Thread John Gordon
In kwakukwat...@gmail.com writes: > thanks for ur help I wz able to do it.but I wish to expand it by asking > a user to input a number for the sqrt to be calculated it I dd it this > way but its not working. > from math import sqrt > number = raw_input('enter a number:') > def number(y): >

Re: Previous Question Answered - Thank You All For Your Replies

2013-01-09 Thread Dave Angel
On 01/09/2013 12:11 PM, Reed, Kevin wrote: > Hello, > > My question concerning wiki.python.org unavailability has been answered. > Thank you all for your assistance! You guys are awesome! > > For those of you who don't know, here's the info. > > http://mail.python.org/pipermail/python-list/2013-

Previous Question Answered - Thank You All For Your Replies

2013-01-09 Thread Reed, Kevin
Hello, My question concerning wiki.python.org unavailability has been answered. Thank you all for your assistance! You guys are awesome! For those of you who don't know, here's the info. http://mail.python.org/pipermail/python-list/2013-January/638182.html Thanks again, Kevin -- http://ma

Re: wiki.python.org

2013-01-09 Thread Evan Driscoll
On 01/09/2013 10:05 AM, Reed, Kevin wrote: > I have been unable to access wiki.python.org for two days. Is there a > problem with the server, or is it me? I can't speak to why, but it appears down for me as well. I also checked http://www.downforeveryoneorjustme.com/ (which is just about the best

new to python and programming at large.

2013-01-09 Thread kwakukwatiah
thanks for ur help I wz able to do it.but I wish to expand it by asking a user to input a number for the sqrt to be calculated it I dd it this way but its not working. from math import sqrt number = raw_input('enter a number:') def number(y): return number(Y) thnx-- http://mail.python.or

Re: wiki.python.org

2013-01-09 Thread Benjamin Kaplan
On Wed, Jan 9, 2013 at 8:30 AM, Ken wrote: > On Wed, Jan 09, 2013 at 04:05:31PM +, Reed, Kevin wrote: >> Hello, >> >> I have been unable to access wiki.python.org for two days. Is there a >> problem with the server, or is it me? >> >> Thank you much, >> >> Kevin C. Reed >> New Python User >

Re: wiki.python.org

2013-01-09 Thread Ben Carleton
- Original Message - > From: "Kevin Reed" > To: python-list@python.org > Sent: Wednesday, January 9, 2013 11:05:31 AM > Subject: wiki.python.org > Hello, > I have been unable to access wiki.python.org for two days. Is there a problem > with the server, or is it me? > Thank you much,

Re: wiki.python.org

2013-01-09 Thread Ken
On Wed, Jan 09, 2013 at 04:05:31PM +, Reed, Kevin wrote: > Hello, > > I have been unable to access wiki.python.org for two days. Is there a > problem with the server, or is it me? > > Thank you much, > > Kevin C. Reed > New Python User Well, I just tried it twice and could not get there,

Re: wiki.python.org

2013-01-09 Thread Matty Sarro
Wiki.python.org was compromised a few days ago, almost everything was wiped per a previous email. Not sure what the recovery status is. On Wed, Jan 9, 2013 at 11:05 AM, Reed, Kevin wrote: > Hello, > > ** ** > > I have been unable to access wiki.python.org for two days. Is there a > proble

RE: new to python and programming at large

2013-01-09 Thread Adrian Espinosa Moreno
Hello, you have to use the same parameter, not self which is used in classes def squareroot(n): return sqrt(n) -- Adrián Espinosa. Engineering Support, Wholesale Systems. Jazztel.com De: kwakukwat...@gmail.com [mailto:kwakukwat...@gmail.com] Enviado el: miércoles, 09 de enero de 2013 22:06

Re: new to python and programming at large

2013-01-09 Thread Ulrich Eckhardt
Am 09.01.2013 22:05, schrieb kwakukwat...@gmail.com: pls I want to write a function that can compute for the sqrt root of any number.bt it not working pls help. Whenever describing an error, be precise. In this particular case, we have some sourcecode (which is good!) but what is still missin

wiki.python.org

2013-01-09 Thread Reed, Kevin
Hello, I have been unable to access wiki.python.org for two days. Is there a problem with the server, or is it me? Thank you much, Kevin C. Reed New Python User -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: PyDTLS

2013-01-09 Thread Guido van Rossum
On Tue, Jan 8, 2013 at 11:38 PM, rbit wrote: > On Tue, Jan 8, 2013 at 9:09 PM, Guido van Rossum wrote: >> But don't you have to deal with that when doing synchronous I/O as >> well? It's a datagram protocol after all. > > No: when dealing with blocking sockets, the OpenSSL library activates its >

Interpolating/crossfading a stack of matrices

2013-01-09 Thread raphael
Hi, I want to interpolate (with quadratic splines) a stack of 2D-arrays/matrices y1, y2, y3, ... in a third dimension (which I call x) e.g. for crossfading images. I already have a working code which unfortunately still contains two explicit loops over the rows and colums of the matrices. Insid

Re: new to python and programming at large

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 2:38 AM, Alister wrote: > On Thu, 10 Jan 2013 02:18:11 +1100, Chris Angelico wrote: > >> On Thu, Jan 10, 2013 at 8:03 AM, wrote: >>> pls I want to write a function that can compute for the sqrt root of >>> any number.bt it not working pls help. >>> from math import sqrt

Re: new to python and programming at large

2013-01-09 Thread Alister
On Thu, 10 Jan 2013 02:18:11 +1100, Chris Angelico wrote: > On Thu, Jan 10, 2013 at 8:03 AM, wrote: >> pls I want to write a function that can compute for the sqrt root of >> any number.bt it not working pls help. >> from math import sqrt def squareroot(self): >> x = sqrt(y) >> print x

Re: new to python and programming at large

2013-01-09 Thread Chris Angelico
On Thu, Jan 10, 2013 at 8:03 AM, wrote: > pls I want to write a function that can compute for the sqrt root of any > number.bt it not working pls help. > from math import sqrt > def squareroot(self): > x = sqrt(y) > print x The 'self' argument is a convention used in classes. You probab

new to python and programming at large

2013-01-09 Thread kwakukwatiah
pls I want to write a function that can compute for the sqrt root of any number.bt it not working pls help. from math import sqrt def squareroot(self): x = sqrt(y) print x-- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: PyDTLS

2013-01-09 Thread Neal Becker
A bit OT, but the widespread use of rfc 6347 could have a big impact on my work. I wonder if it's likely to see widespread use? What are likely/possible use cases? Thank. -- http://mail.python.org/mailman/listinfo/python-list

new to python and programming at large

2013-01-09 Thread kwakukwatiah
pls I want to write a function that can compute for the sqrt root of any number.bt it not working pls help. from math import sqrt def squareroot(self): x = sqrt(y) print x-- http://mail.python.org/mailman/listinfo/python-list

Re: PIL or something to open EXIF Metadata with Python

2013-01-09 Thread Tim Golden
On 09/01/2013 14:45, Jose Trevino wrote: > I am trying to load the PIL module to manage exif metadata with > Python but have had no success. Try pyexiv2: http://tilloy.net/dev/pyexiv2/ TJG -- http://mail.python.org/mailman/listinfo/python-list

PIL or something to open EXIF Metadata with Python

2013-01-09 Thread Jose Trevino
I am trying to load the PIL module to manage exif metadata with Python but have had no success. I do some work relate with applescript, but for large files time increases exponentially. So I changed to Python with the intention of using PIL or something similar. I see that the last update of PIL

Re: socket.makefile raises ValueError when mode = 'rt'

2013-01-09 Thread Antoon Pardon
Op 01/09/13 14:54, Dave Angel schreef: > On 01/09/2013 08:22 AM, Antoon Pardon wrote: >> This is using python 3.2. ... >> But the documentation states: >> socket.makefile(mode='r', buffering=None, *, encoding=None, errors=None, >> newline=None) >> Return a file object associated with the socket

Re: socket.makefile raises ValueError when mode = 'rt'

2013-01-09 Thread Dave Angel
On 01/09/2013 08:22 AM, Antoon Pardon wrote: > This is using python 3.2. > > I am writing somekind of wrapper around the ftplib. So > that you can work with it as if you are working with > local files. > > The idea is that you start with making a connection like > > rmt = FTP(...) > > and then do s

socket.makefile raises ValueError when mode = 'rt'

2013-01-09 Thread Antoon Pardon
This is using python 3.2. I am writing somekind of wrapper around the ftplib. So that you can work with it as if you are working with local files. The idea is that you start with making a connection like rmt = FTP(...) and then do something like the following rmtfl = rmt.open("rmtfilename", "r

Re: How to modify this script?

2013-01-09 Thread Kurt Hansen
Den 09/01/13 11.23, chaouche yacine skrev: I figrued it out. Copy/paste exactly these lines in the snippets tool. You can bind it to a key as you may know, I bound it to Ctrl-E. So paste it in a new snippet (keep the original in a safe place), bind to a key, select the text you want to html-table

Re: Regex not matching a string

2013-01-09 Thread Peter Otten
python.pro...@gmail.com wrote: > In the following code ,am trying to remove a multi line - comment that > contains "This is a test comment" for some reason the regex is not > matching.. can anyone provide inputs on why it is so? > def find_and_remove(haystack, needle): > pattern = re.compile(

Re: Regex not matching a string

2013-01-09 Thread Steven D'Aprano
On Wed, 09 Jan 2013 02:08:23 -0800, python.prog29 wrote: > Hi All - > > > In the following code ,am trying to remove a multi line - comment that > contains "This is a test comment" for some reason the regex is not > matching.. can anyone provide inputs on why it is so? It works for me. Some ob

Re: How to modify this script?

2013-01-09 Thread chaouche yacine
I figrued it out. Copy/paste exactly these lines in the snippets tool. You can bind it to a key as you may know, I bound it to Ctrl-E. So paste it in a new snippet (keep the original in a safe place), bind to a key, select the text you want to html-tableize and hit the key binding. In my case it

Regex not matching a string

2013-01-09 Thread python . prog29
Hi All - In the following code ,am trying to remove a multi line - comment that contains "This is a test comment" for some reason the regex is not matching.. can anyone provide inputs on why it is so? import os import sys import re import fnmatch def find_and_remove(haystack, needle): pat

Re: How to get the selected text of the webpage in chrome through python ?

2013-01-09 Thread Alister
On Mon, 07 Jan 2013 20:20:28 -0800, iMath wrote: > How to get the selected text of the webpage in chrome through python ? i think you need to explain your requirement further also what do you want to do to the text once you have it? -- Genius is one percent inspiration and ninety-nine perce

Re: How to modify this script?

2013-01-09 Thread Kurt Hansen
Den 06/01/13 15.20, Chris Angelico wrote: That version should work. Am 06.01.2013 15:30 schrieb Kurt Hansen: It certainly does. I'll keep it and use it until at better solution is found. On 08/01/13 15.18, Thomas Rachel wrote: > That would be simple: Replace output += '' + item + ' '

Re: How to modify this script?

2013-01-09 Thread Kurt Hansen
Den 08/01/13 16.31, chaouche yacine skrev: Well tell me how do you use this script in gedit, are you using it as a plugin ? "Snippets" is a plugin, yes. It's included in the .app for Mac (v. 2.30.2), but not activated af default. Open "Tools" in the menu line and click "Manage snippets...".

Re: functon invoke or not

2013-01-09 Thread Jussi Piitulainen
skyworld writes: > Hi, > > I see someone's code as this: > > class ABC: > def __init__(self, env): > ... > self.jmpTable['batchQ']['submit_job'] = self.lsf_submit > ... > def lsf_submit(self, cmd,env): > . > > what confused me is why

Re: functon invoke or not

2013-01-09 Thread skyworld
On 1月9日, 下午4时46分, Mitya Sirenef wrote: > On Wed 09 Jan 2013 03:23:56 AM EST, skyworld wrote: > > > Hi, > > > I see someone's code as this: > > > class ABC: > >      def __init__(self, env): > >           ... > >           self.jmpTable['batchQ']['submit_job']  = self.lsf_submit > >      

Re: functon invoke or not

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 03:23:56 AM EST, skyworld wrote: Hi, I see someone's code as this: class ABC: def __init__(self, env): ... self.jmpTable['batchQ']['submit_job'] = self.lsf_submit ... def lsf_submit(self, cmd,env): . what co

Re: functon invoke or not

2013-01-09 Thread Peter Otten
skyworld wrote: > Hi, > > I see someone's code as this: > > class ABC: > def __init__(self, env): > ... > self.jmpTable['batchQ']['submit_job'] = self.lsf_submit The bound method self.lsf_submit is not invoked in this line, it is stored for later use. >

functon invoke or not

2013-01-09 Thread skyworld
Hi, I see someone's code as this: class ABC: def __init__(self, env): ... self.jmpTable['batchQ']['submit_job'] = self.lsf_submit ... def lsf_submit(self, cmd,env): . what confused me is why there is no parentheses for self.lsf_submit