Re: How can I define class methods outside of the class?

2010-12-01 Thread Ian Kelly
On 12/1/2010 10:47 PM, James Mills wrote: On Thu, Dec 2, 2010 at 3:36 PM, Jeremy wrote: I have some methods that I need (would like) to define outside of the class. I know this can be done by defining the function and then setting it equal to some member of an instance of the class. But, beca

Comparison with False - something I don't understand

2010-12-01 Thread Harishankar
When I run pychecker through my modules I get the message that comparisons with "False" is not necessary and that it might yield unexpected results. Yet in some situations I need to specifically check whether False was returned or None was returned. Why is comparison with False so bad? # examp

DBF (VFP) to XLS (Excel) in pure Python

2010-12-01 Thread kirby.ur...@gmail.com
Playing around with arcane tools to read those pesky DBF files (with memo fields), like floating wine barrels cast off the sinking VFP ship. http://pypi.python.org/pypi/dbf http://packages.python.org/dbf/dbf-module.html Me threading on comp.lang.python: http://bit.ly/e547Za xlwt and xlrt for rea

Re: Some syntactic sugar proposals

2010-12-01 Thread Steven D'Aprano
On Wed, 01 Dec 2010 15:18:32 -0800, Dmitry Groshev wrote: > Here is a fresh example of what I meant by my first proposal. You need > to build a matrix like this: > 2 1 0 ... > 1 2 1 ... > 0 1 2 ... > ... > ... 1 2 1 > ... 0 1 2 > You could do this by one-liner: > [[(2 - abs(x - y)) if it > 0 else

Unicode thing that causes a traceback in 2.6 and 2.7 but not in 2.5, and only when writing to a pipe, not to the terminal

2010-12-01 Thread Dan Stromberg
What is this about? It's another n~ thing, but this time in 2.x. All I'm doing is printing a str containing a character > 127. It works fine in 2.5, to a terminal or to a pipe. In 2.6 and 2.7, it fails when writing to a pipe but works fine writing to my terminal - an mrxvt.\ I really kind of wa

Re: How can I define class methods outside of the class?

2010-12-01 Thread James Mills
On Thu, Dec 2, 2010 at 3:36 PM, Jeremy wrote: > I have some methods that I need (would like) to define outside of the > class.  I know this can be done by defining the function and then > setting it equal to some member of an instance of the class.  But, > because of the complexity of what I'm doi

How can I define class methods outside of the class?

2010-12-01 Thread Jeremy
I have some methods that I need (would like) to define outside of the class. I know this can be done by defining the function and then setting it equal to some member of an instance of the class. But, because of the complexity of what I'm doing (I have to set many functions as class methods) I wo

Re: odd runtime error

2010-12-01 Thread Cameron Simpson
On 01Dec2010 17:27, David Brown wrote: | Thanks for the clarification No worries. | I like the idea of wrapping all the | primary code in the script to a main function then calling it if its | being called by main. I find that useful too. I've got a few modules-that-implement-commands that look

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Bill Allen
Thanks for the explanation of "main". Some tutorials mention it, some don't. I have written some not trial Python programs and have never had a real need to use that convention, but at least I understand it now. --Bill On Wed, Dec 1, 2010 at 1:13 PM, Tim Harig wrote: > > On Wed, Dec 1, 2010

Re: docstring inheritance

2010-12-01 Thread HughSW
G, sorry about the line wrapping horror; trying again. class InheritDoc(object): """ Docstring inheriting method descriptor The class itself is used as a decorator that creates a class property for the method; the first time the property is used it installs the method's doc

docstring inheritance

2010-12-01 Thread HughSW
We've been trying to find an easy way to inherit docstrings when overriding methods in subclasses, e.g. so that Sphinx does a nice job. We used Shai's DocInherit code from this post: http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/1e4075ba10dcbdd9/f63651cd9e76df63?rnum=1&_d

Re: Packages at Python.org

2010-12-01 Thread kirby urner
Good to hear from you sir. I've enjoying working with your modules and am getting some good results. I sent you a note off-list wondering how actively you might be supporting this valuable utility. Encouraging to find you here so quickly. Kirby On Wed, Dec 1, 2010 at 2:32 PM, Ethan Furman wr

Re: multiple modules from single c extension

2010-12-01 Thread Robert Kern
On 12/1/10 4:12 PM, Eric Frederich wrote: I have an extension to some C library that I created using the guide found here... http://docs.python.org/extending/extending.html I am starting to have A LOT of functions being wrapped. The library that I'm creating bindings for is organized into

Re: odd runtime error

2010-12-01 Thread David Brown
On Wed, Dec 1, 2010 at 5:19 PM, Cameron Simpson wrote: > On 01Dec2010 16:49, David Brown wrote: > | So I'm not subscribed to python-list but would like to get an answer > | to my question. I've made a small test program that dumps a > | RuntimeError and I'd like to know why. > | > | $ python test

Re: odd runtime error

2010-12-01 Thread Cameron Simpson
On 01Dec2010 16:49, David Brown wrote: | So I'm not subscribed to python-list but would like to get an answer | to my question. I've made a small test program that dumps a | RuntimeError and I'd like to know why. | | $ python test2.py | doing stuff | Traceback (most recent call last): | File "t

Re: odd runtime error

2010-12-01 Thread James Mills
On Thu, Dec 2, 2010 at 10:59 AM, Chris Rebert wrote: > On Wed, Dec 1, 2010 at 4:49 PM, David Brown wrote: >> So I'm not subscribed to python-list but would like to get an answer >> to my question. I've made a small test program that dumps a >> RuntimeError and I'd like to know why. >> >> $ python

Re: odd runtime error

2010-12-01 Thread David Brown
On Wed, Dec 1, 2010 at 4:59 PM, Chris Rebert wrote: > On Wed, Dec 1, 2010 at 4:49 PM, David Brown wrote: >> So I'm not subscribed to python-list but would like to get an answer >> to my question. I've made a small test program that dumps a >> RuntimeError and I'd like to know why. >> >> $ python

Re: odd runtime error

2010-12-01 Thread Chris Rebert
On Wed, Dec 1, 2010 at 4:49 PM, David Brown wrote: > So I'm not subscribed to python-list but would like to get an answer > to my question. I've made a small test program that dumps a > RuntimeError and I'd like to know why. > > $ python test2.py > doing stuff > Traceback (most recent call last):

I can't seem to change the timeout value on pexpect

2010-12-01 Thread chad
I tried to change the timeout value from 30 to 90 for pexpect in the following script... #!/usr/bin/python import telnetlib import time import pexpect def get_name(): user = raw_input("\nUsername: ") password = raw_input("Password: ") idle(user, password) def idle(user, password):

odd runtime error

2010-12-01 Thread David Brown
So I'm not subscribed to python-list but would like to get an answer to my question. I've made a small test program that dumps a RuntimeError and I'd like to know why. $ python test2.py doing stuff Traceback (most recent call last): File "test2.py", line 3, in import test RuntimeError: not

Re: Some syntactic sugar proposals

2010-12-01 Thread Dmitry Groshev
On Nov 22, 2:21 pm, Andreas Löscher wrote: > >     if x in range(a, b): #wrong! > > it feels so natural to check it that way, but we have to write > >     if a <= x <= b > > I understand that it's not a big deal, but it would be awesome to have > > some optimisations - it's clearly possible to det

Re: Packages at Python.org

2010-12-01 Thread Jon Clements
On Dec 1, 10:32 pm, Ethan Furman wrote: > kirby.ur...@gmail.com wrote: > > > With Microsoft abandoning Visual FoxPro come 2015, we have 100K > > developers > > jumping ship (rough guess), perhaps to dot NET, but not necessarily.** > > > This page is potentially getting a lot of hits (I'm not privy

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-12-01 Thread Nobody
On Wed, 01 Dec 2010 10:34:24 +0100, Peter Otten wrote: >> Python 3.x's decision to treat filenames (and environment variables) as >> text even on Unix is, in short, a bug. One which, IMNSHO, will mean that >> Python 2.x is still around when Python 4 is released. > > For filenames in Python 3 the

Re: Change one list item in place

2010-12-01 Thread Steven D'Aprano
On Wed, 01 Dec 2010 05:33:55 -0800, Gnarlodious wrote: > Thanks for all the ideas, I've resigned myself to unpacking a tuple and > reassembling it. You make it sound like that's an onerous task. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Packages at Python.org

2010-12-01 Thread Ethan Furman
kirby.ur...@gmail.com wrote: With Microsoft abandoning Visual FoxPro come 2015, we have 100K developers jumping ship (rough guess), perhaps to dot NET, but not necessarily.** This page is potentially getting a lot of hits (I'm not privy to the analytics): http://packages.python.org/dbf/ The

multiple modules from single c extension

2010-12-01 Thread Eric Frederich
I have an extension to some C library that I created using the guide found here... http://docs.python.org/extending/extending.html I am starting to have A LOT of functions being wrapped. The library that I'm creating bindings for is organized into modules. In fact, all of their function call

Re: Packages at Python.org

2010-12-01 Thread python
> You may want to take a look at Dabo > http://dabodev.com/ +1 Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: Packages at Python.org

2010-12-01 Thread Jon Clements
On Dec 1, 8:56 pm, "kirby.ur...@gmail.com" wrote: > >http://packages.python.org/dbf/ > > > So how *do* you get source code from such a web place?  I'm not > > finding > > a tar ball or installer.  Sorry if I'm missing something obvious, like > > a link > > to Sourceforge. > > Thanks to very quick

Re: Packages at Python.org

2010-12-01 Thread Robert Kern
On 12/1/10 2:56 PM, kirby.ur...@gmail.com wrote: http://packages.python.org/dbf/ So how *do* you get source code from such a web place? I'm not finding a tar ball or installer. Sorry if I'm missing something obvious, like a link to Sourceforge. Thanks to very quick replies with pointers t

Re: Packages at Python.org

2010-12-01 Thread Chris Rebert
On Wed, Dec 1, 2010 at 12:56 PM, kirby.ur...@gmail.com wrote: >> http://packages.python.org/dbf/ >> >> So how *do* you get source code from such a web place?  I'm not >> finding >> a tar ball or installer.  Sorry if I'm missing something obvious, like >> a link >> to Sourceforge. >> > > Thanks to

Re: Packages at Python.org

2010-12-01 Thread kirby.ur...@gmail.com
> http://packages.python.org/dbf/ > > So how *do* you get source code from such a web place?  I'm not > finding > a tar ball or installer.  Sorry if I'm missing something obvious, like > a link > to Sourceforge. > Thanks to very quick replies with pointers to http://pypi.python.org/pypi/dbf/ in

RE: Packages at Python.org

2010-12-01 Thread Dino Viehland
Kirby wrote: > ** Unconfirmed rumors about IronPython leave me blog searching this > afternoon. Still part of Codeplex? IronPython is still using CodePlex for bug tracking and posting releases but active development is now on GitHub w/ a Mercurial mirror. Jeff's blog has more info: http://jdha

Re: Packages at Python.org

2010-12-01 Thread Ian
On Dec 1, 1:38 pm, "kirby.ur...@gmail.com" wrote: > http://packages.python.org/dbf/ > > So how *do* you get source code from such a web place?  I'm not > finding > a tar ball or installer.  Sorry if I'm missing something obvious, like > a link > to Sourceforge. That site only contains documentati

Re: Packages at Python.org

2010-12-01 Thread Chris Rebert
On Wed, Dec 1, 2010 at 12:38 PM, kirby.ur...@gmail.com wrote: > With Microsoft abandoning Visual FoxPro come 2015, we have 100K > developers > jumping ship (rough guess), perhaps to dot NET, but not necessarily.** > > This page is potentially getting a lot of hits (I'm not privy to the > analytics

Packages at Python.org

2010-12-01 Thread kirby.ur...@gmail.com
With Microsoft abandoning Visual FoxPro come 2015, we have 100K developers jumping ship (rough guess), perhaps to dot NET, but not necessarily.** This page is potentially getting a lot of hits (I'm not privy to the analytics): http://packages.python.org/dbf/ So how *do* you get source code fro

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Tim Harig
> On Wed, Dec 1, 2010 at 9:08 AM, m b wrote: >>> > if __name__ == "__main__": >>> > main() >> >> What does this mean? It is a Python idiom and a good practice. Strictly speaking it is unnecessary. Python doesn't recognize any functional initialization vector other then the start of the file. W

Re: Catching user switching and getting current active user from root on linux

2010-12-01 Thread Mark Wooding
Grant Edwards writes: > On 2010-11-30, mpnordland wrote: > > and catch user switching eg user1 locks screen, leaves computer, > > user2 comes, and logs on. basically, when there is any type of user > > switch my script needs to know. > > What do you do when there are multiple users logged in? I

Re: string find/replace

2010-12-01 Thread MRAB
On 01/12/2010 17:36, Carlo wrote: Hello, I want the Python equivalent of the Perl expression: s/([a-z])([A-Z])/\1 \2/g In plain language: place a space between a lowercase and uppercase letter. I get lost in the RE module. Can someone help me? That's easy: new_text = re.sub(r'([a-z])([A-Z

Re: string find/replace

2010-12-01 Thread Carlo
On 2010-12-01, Peter Otten <__pete...@web.de> wrote: import re re.compile("([a-z])([A-Z])").sub(r"\1 \2", "camelCase") > 'camel Case' Very simple if you know it. Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: string find/replace

2010-12-01 Thread Donald O'Donnell
On Dec 1, 12:36 pm, Carlo wrote: > Hello, > > I want the Python equivalent of the Perl expression: > s/([a-z])([A-Z])/\1 \2/g > In plain language: place a space between a lowercase and uppercase > letter. I get lost in the RE module. Can someone help me? > > Thanks! This will also replace '_' wit

Re: string find/replace

2010-12-01 Thread Peter Otten
Carlo wrote: > I want the Python equivalent of the Perl expression: > s/([a-z])([A-Z])/\1 \2/g > In plain language: place a space between a lowercase and uppercase > letter. I get lost in the RE module. Can someone help me? >>> import re >>> re.compile("([a-z])([A-Z])").sub(r"\1 \2", "camelCase")

string find/replace

2010-12-01 Thread Carlo
Hello, I want the Python equivalent of the Perl expression: s/([a-z])([A-Z])/\1 \2/g In plain language: place a space between a lowercase and uppercase letter. I get lost in the RE module. Can someone help me? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Steve Holden
On 12/1/2010 12:08 PM, m b wrote: > > >> > >> > if __name__ == "__main__": >> > main() > > What does this mean? > > /Mikael > It's a standard way of allowing programs to test themselves. When a module is imported its __name__ attribute us bound to the name of the module. When the module is run

Re: Regarding searching directory and to delete it with specific pattern.

2010-12-01 Thread MRAB
On 01/12/2010 07:07, Ramprakash Jelari thinakaran wrote: Hi all, Would like to search list of directories with specific pattern and delete it?.. How can i do it?. Example: in /home/jpr/ i have the following list of directories. 1.2.3-2, 1.2.3-10, 1.2.3-8, i would like to delete the directories o

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Hanif Jameel
On 01/12/2010 17:08, m b wrote: > > > > if __name__ == "__main__": > > main() What does this mean? /Mikael Python will not cause the main() function to run automatically when you execute the script, it has to be called. __name__ is a special variable which is set by the python interpre

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Benjamin Kaplan
On Wed, Dec 1, 2010 at 12:08 PM, m b wrote: > > >> > >> > if __name__ == "__main__": >> > main() > > What does this mean? > > /Mikael > Every module has an attribute called __name__. Normally, it's the name of the module itself. However, the module being run as a script (rather than imported) is

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Jean-Michel Pichavant
m b wrote: > > > > if __name__ == "__main__": > > main() What does this mean? /Mikael __name__ is an attribute of the module. Usually it is set to the module name, except when the module is acutally executed as the entry point, in that case __name__ is set to '__main__'. foo.py: print __n

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Chris Rebert
On Wed, Dec 1, 2010 at 9:08 AM, m b wrote: >> > >> > if __name__ == "__main__": >> > main() > > What does this mean? See http://effbot.org/pyfaq/tutor-what-is-if-name-main-for.htm (which is the 3rd Google hit for "__main__") Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: strange TypeError exception in function compiled from a string

2010-12-01 Thread MRAB
On 01/12/2010 13:48, nelson wrote: Hi all, I have this function, defined in a string and ecetuted through ad exec call def cell1(d): x=d.get('x') print x import y return y.add(y.add(self.adf0(x),self.adf0(x)),self.adf0(x)) d is a dict of this kind {'x':2} I receive th

RE: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread m b
> > > > if __name__ == "__main__": > > main() What does this mean? /Mikael -- http://mail.python.org/mailman/listinfo/python-list

Re: Login using usrllib2

2010-12-01 Thread Jon Clements
On Dec 1, 10:16 am, Chris Rebert wrote: > On Wed, Dec 1, 2010 at 1:53 AM,   wrote: > > Hi All, > > > I'm using urllib2 module to login to an https server. However I'm unable to > > login as the password is not getting accepted. > > > Here is the code: > > > import urllib2, urllib > > values={'User

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Jean-Michel Pichavant
Tim Harig wrote: On 2010-12-01, goldtech wrote: Start Main Global Var Subprogram1 Subprogram2 Subprogram3 End of Main End module_wide_var = value def Subprogram1: # code def Subprogram2: # code def Subprogram3: # code def main: Subpr

Re: Python's equivalent to Main calling program and subprograms

2010-12-01 Thread Tim Harig
On 2010-12-01, goldtech wrote: > Start > Main > Global Var > Subprogram1 > Subprogram2 > Subprogram3 > End of Main > End module_wide_var = value def Subprogram1: # code def Subprogram2: # code def Subprogram3: # code def main: Subprogram1()

Python's equivalent to Main calling program and subprograms

2010-12-01 Thread goldtech
Hi, Could someone link me to info - I'm sure this is commonly done: "Long ago" with Fortran and Pascal there was a pattern used a lot. It was like: Start Main Global Var Subprogram1 Subprogram2 Subprogram3 End of Main End The global var was a var that all the subprograms could a

Wing IDE 3.2.12 released

2010-12-01 Thread Wingware
Hi, Wingware has released version 3.2.12 of Wing IDE, an integrated development environment designed specifically for the Python programming language. This release includes the following improvements: * Support for Stackless version 2.7 * Correctly ignore exceptions in debugger for logged excep

Decorate un Frame with window managers title bar, etc en Tkinter 8.5

2010-12-01 Thread craf
Hi. I use python 3.1 and Tkinter 8.5 in Ubuntu 9.10 I would like to turn a frame into a toolbox, ,and for that I read that you can use the command wm manage (window) The information can be found at: http://www.tcl.tk/man/tcl8.5/TkCmd/wm.htm#M39 the explanation says: wm manage widget:

Re: Catching user switching and getting current active user from root on linux

2010-12-01 Thread Grant Edwards
On 2010-11-30, mpnordland wrote: > I have situation where I need to be able to get the current active > user, How do you define "current active user"? > and catch user switching eg user1 locks screen, leaves computer, > user2 comes, and logs on. basically, when there is any type of user > switc

Re: When to use codecs vs. io module (Python 2.7 and higher)

2010-12-01 Thread Antoine Pitrou
On Wed, 01 Dec 2010 09:55:01 -0500 pyt...@bdurham.com wrote: > Python 2.7 or higher: Looking for reasons/scenarios where one > should use the codecs vs. io module. > > Are there use cases that favor one specific module over the other > module? > > My understanding is that the io module is much fa

Re: To Thread or not to Thread....?

2010-12-01 Thread Antoine Pitrou
On Wed, 1 Dec 2010 23:48:38 +1000 James Mills wrote: > Surely I2C is just a serial-like interface > and one should be able to do async I/O on it ? > > The use of threads is not necessary here and the GIL > doesn't become a problem in async I/O anyway. Well, you are missing the point. The OP want

When to use codecs vs. io module (Python 2.7 and higher)

2010-12-01 Thread python
Python 2.7 or higher: Looking for reasons/scenarios where one should use the codecs vs. io module. Are there use cases that favor one specific module over the other module? My understanding is that the io module is much faster than the codecs module (and can be used interchangably), but the codec

Re: To Thread or not to Thread....?

2010-12-01 Thread Werner Thie
Hi I see quite a few alleys to go down when stuck with such types of problems, but instead of listing and discussing them have a look at a quite complete discussion and comparison of the various async programming options available at http://syncless.googlecode.com Also have a look at the pr

position independent build of python

2010-12-01 Thread erikj
Hi, If my understanding is correct, the sys.prefix variable holds the root directory python uses to find related files, and eg its site-packages. the value of sys.prefix is specified at compile time. it seems that on windows, when I build/install python at one location, and later move it to anot

Re: strange TypeError exception in function compiled from a string

2010-12-01 Thread bruno.desthuilli...@gmail.com
On 1 déc, 14:48, nelson wrote: > Hi all, >   I have this function, defined in a string and ecetuted through ad > exec call > > def cell1(d): > >     x=d.get('x') >     print x > >     import y >     return y.add(y.add(self.adf0(x),self.adf0(x)),self.adf0(x)) > > d is a dict of this kind {'x':2} >

Re: Change one list item in place

2010-12-01 Thread Jean-Michel Pichavant
Gnarlodious wrote: On Dec 1, 6:23 am, Jean-Michel Pichavant wrote: what about def query(): return ["Formating only {0} into a string".format(sendList()[0])] + sendList()[1:] However this solution calls sendList() twice, which is too processor intensive. You got to get rid of

Re: How to initialize each multithreading Pool worker with an individual value?

2010-12-01 Thread Valery Khamenya
Hi Dan, > If you create in the parent a queue in shared memory (multiprocessing > facilitates this nicely), and fill that queue with the values in your > ports tuple, then you could have each child in the worker pool extract > a single value from this queue so each worker can have its own, unique

strange TypeError exception in function compiled from a string

2010-12-01 Thread nelson
Hi all, I have this function, defined in a string and ecetuted through ad exec call def cell1(d): x=d.get('x') print x import y return y.add(y.add(self.adf0(x),self.adf0(x)),self.adf0(x)) d is a dict of this kind {'x':2} I receive the following exception, that i find very st

Re: To Thread or not to Thread....?

2010-12-01 Thread James Mills
Surely I2C is just a serial-like interface and one should be able to do async I/O on it ? The use of threads is not necessary here and the GIL doesn't become a problem in async I/O anyway. I only use threads for operating that might block (not for I/O). cheers James On Wed, Dec 1, 2010 at 7:24

Re: Change one list item in place

2010-12-01 Thread Gnarlodious
On Dec 1, 6:23 am, Jean-Michel Pichavant wrote: > what about > > def query(): >     return ["Formating only {0} into a string".format(sendList()[0])] + > sendList()[1:] However this solution calls sendList() twice, which is too processor intensive. Thanks for all the ideas, I've resigned myself

Re: SAX unicode and ascii parsing problem

2010-12-01 Thread Adam Tauno Williams
On Tue, 2010-11-30 at 12:28 -0800, goldtech wrote: > I'm trying to parse an xml file using SAX. About half-way through a > file I get this error: > Traceback (most recent call last): > File "C:\Python26\Lib\site-packages\pythonwin\pywin\framework > \scriptutils.py", line 325, in RunScript >

Re: Change one list item in place

2010-12-01 Thread Jean-Michel Pichavant
Gnarlodious wrote: This works for me: def sendList(): return ["item0", "item1"] def query(): l=sendList() return ["Formatting only {0} into a string".format(l[0]), l[1]] query() However, is there a way to bypass the l=sendList() and change one list item in-place? Possibly a lis

SFTP: max bytes to be transferred

2010-12-01 Thread Dario Beraldi
Hello, I'm using the module paramiko to transfer files via sftp (see code below). I would like to specify the maximum amount of bytes to be transferred (say 10MB, if the file is bigger just transfer up to these many bytes). From the docs of paramiko (http://www.lag.net/paramiko/docs/paramik

RE: Reading by positions plain text files

2010-12-01 Thread Javier Van Dam
Ok. I will try it and let you know. Thanks a lot!! J > Date: Tue, 30 Nov 2010 20:32:56 -0600 > From: python.l...@tim.thechases.com > To: javiervan...@gmail.com > CC: python-list@python.org > Subject: Re: Reading by positions plain text files > > On 11/30/2010 08:03 PM, javivd wrote: > > On Nov

Re: To Thread or not to Thread....?

2010-12-01 Thread Antoine Pitrou
On Wed, 1 Dec 2010 11:50:46 + Jack Keegan wrote: > Hi Antoine, > > On Wed, Dec 1, 2010 at 9:24 AM, Antoine Pitrou wrote: > > > > > > The main question IMO: the I2C bus operates at 400kHz, but how much > > received data can it buffer? That will give you a hint as to how much > > latency you c

Re: To Thread or not to Thread....?

2010-12-01 Thread Jack Keegan
Hi Antoine, On Wed, Dec 1, 2010 at 9:24 AM, Antoine Pitrou wrote: > > > The main question IMO: the I2C bus operates at 400kHz, but how much > received data can it buffer? That will give you a hint as to how much > latency you can tolerate. > I'm not sure on buffering, but I have to ask the device

Re: Login using usrllib2

2010-12-01 Thread Chris Rebert
On Wed, Dec 1, 2010 at 1:53 AM, wrote: > Hi All, > > > I'm using urllib2 module to login to an https server. However I'm unable to > login as the password is not getting accepted. > > Here is the code: > > import urllib2, urllib > values={'Username': 'admin', 'Password': 'admin123'} > url='https:

Login using usrllib2

2010-12-01 Thread dudeja . rajat
Hi All, I'm using urllib2 module to login to an https server. However I'm unable to login as the password is not getting accepted. Here is the code: import urllib2, urllib values={'Username': 'admin', 'Password': 'admin123'} url='https://172.25.17.20:9443' data = urllib.urlencode(values) data

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-12-01 Thread Peter Otten
Nobody wrote: > Python 3.x's decision to treat filenames (and environment variables) as > text even on Unix is, in short, a bug. One which, IMNSHO, will mean that > Python 2.x is still around when Python 4 is released. For filenames in Python 3 the user has the choice between "text" (str) and by

Re: Programming games in historical linguistics with Python

2010-12-01 Thread Steven D'Aprano
On Tue, 30 Nov 2010 07:03:28 -0800, Dax Bloom wrote: > Is there a way to refer to vowels and consonants as a subcategory of > text? Is there a function to remove all vowels? How should one create > and order the dictionary file for the rules? How to chain several > transformations automatically fr

Re: To Thread or not to Thread....?

2010-12-01 Thread Antoine Pitrou
On Wed, 1 Dec 2010 02:45:50 + Jack Keegan wrote: > Hi there, > > I'm currently writing an application to control and take measurements during > an experiments. This is to be done on an embedded computer running XPe so I > am happy to have python available, although I am pretty new to it. > T

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-12-01 Thread Antoine Pitrou
On Tue, 30 Nov 2010 22:22:01 -0500 Albert Hopkins wrote: > And I can freely copy > these "invalid" files across different (Unix) systems, because the OS > doesn't care about encoding. And so can Python, thanks to PEP 383. > > That's where encodings which can be used globally come in. > > By the

Re: Change one list item in place

2010-12-01 Thread Steven D'Aprano
On Wed, 01 Dec 2010 08:54:49 +, Steven D'Aprano wrote: > An alternative would be: > Please ignore. That was an accidental Send mid-edit. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-12-01 Thread Antoine Pitrou
On Tue, 30 Nov 2010 16:57:57 -0800 Dan Stromberg wrote: > >> --- On Tue, 11/30/10, Dan Stromberg wrote: > >> > In Python 3, I'm finding that I have encoding issues with > >> > characters > >> > with their high bit set.  Things are fine with strictly > >> > ASCII > >> > filenames.  With high-bit-s

Re: SAX unicode and ascii parsing problem

2010-12-01 Thread Ulrich Eckhardt
goldtech wrote: > I tried this but nothing changed, I thought this might convert it and > then I'd paerse the new file - didn't work: > > uc = open(r'E:\sc\ppb4.xml').read().decode('utf8') > ascii = uc.decode('ascii') > mex9 = open( r'E:\scrapes\ppb5.xml', 'w' ) > mex9.write(ascii) This doesn't m

Re: Change one list item in place

2010-12-01 Thread Steven D'Aprano
On Tue, 30 Nov 2010 17:08:57 -0800, Gnarlodious wrote: > This works for me: > > def sendList(): > return ["item0", "item1"] > > def query(): > l=sendList() > return ["Formatting only {0} into a string".format(l[0]), l[1]] For the record, you're not actually changing a list in place

Re: Catching user switching and getting current active user from root on linux

2010-12-01 Thread Tim Golden
On 30/11/2010 22:47, mpnordland wrote: I have situation where I need to be able to get the current active user, and catch user switching eg user1 locks screen, leaves computer, user2 comes, and logs on. basically, when there is any type of user switch my script needs to know. If it's Windows yo

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-12-01 Thread Nobody
On Wed, 01 Dec 2010 02:14:09 +, MRAB wrote: > If the filenames are to be shown to a user then there needs to be a > mapping between bytes and glyphs. That's an encoding. If different > users use different encodings then exchange of textual data becomes > difficult. OTOH, the exchange of binar

Iran slams Wiki-release as US psywar - WIKILEAKS is replacing those BIN LADEN communiques of CIA (the global ELITE) intended to threaten MASSES

2010-12-01 Thread small Pox
Iran slams Wiki-release as US psywar - WIKILEAKS is replacing those BIN LADEN communiques of CIA (the global ELITE) intended to threaten MASSES CIA is the criminal agency of the global elite. They want to destroy the middle class from the planet and also create a global tyranny of a police state.