Re: [BangPypers] Help On Paramiko

2012-06-18 Thread Noufal Ibrahim
Fabric is a library built on paramiko that gives you abstractions so that you don't have to worry about things at such a fine grained level. Perhaps you should try using that. writes: > Howdy All, > > I am trying to use paramiko to automate logging in to remote unix machines > and executing so

Help On Paramiko

2012-06-18 Thread Nikunj.Badjatya
Howdy All, I am trying to use paramiko to automate logging in to remote unix machines and executing some commands there. When I normally do ssh from my linux machine (with Python 2.6) to this machine a different '>' prompt comes. It's a device specific custom prompt. After I run 'enable' command

Re: "constant sharing" works differently in REPL than in script ?

2012-06-18 Thread Peter Otten
shearich...@gmail.com wrote: > Listening to 'Radio Free Python' episode 8 > (http://radiofreepython.com/episodes/8/ - around about the 30 minute mark) > I heard that Python pre creates some integer constants to avoid a > proliferation of objects with the same value. > > I was interested in this a

Re: Checking compatibility of a script across Python versions automatically

2012-06-18 Thread Stefan Behnel
Andrew Berg, 18.06.2012 21:24: > Are there any tools out there that will parse a script and tell me if it > is compatible with an arbitrary version of Python and highlight any > incompatibilities? I need to check a few of my scripts that target 3.2 > to see if I can make them compatible with 3.0 an

Re: [chennaipy 1376] Pymongo Error

2012-06-18 Thread Ramesh Seshadri
Are you using django-nonrel or basic django version? Check out http://www.allbuttonspressed.com/projects/django-nonrel cheers Ramesh On Tue, Jun 19, 2012 at 10:52 AM, Ranjith Kumar wrote: > Hi all, > I tried Django with Mongodb while running manage.py syncdb I endup with > this error > > note

Pymongo Error

2012-06-18 Thread Ranjith Kumar
Hi all, I tried Django with Mongodb while running manage.py syncdb I endup with this error note : it works fine with sqlite and mysql db (django-1.3)ranjith@ranjith:~/ sandbox/python-box/hukkster-core-site/hukk$ ./manage.py syncdb /home/ranjith/virtualenvs/django-1.3/local/lib/python2.7/site-pack

Re: "constant sharing" works differently in REPL than in script ?

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 7:52 PM, wrote: > Listening to 'Radio Free Python' episode 8 > (http://radiofreepython.com/episodes/8/ - around about the 30 minute mark) I > heard that Python pre creates some integer constants to avoid a proliferation > of objects with the same value. > > I was intere

Re: lazy evaluation of a variable

2012-06-18 Thread rantingrickjohnson
On Sunday, June 17, 2012 6:01:03 PM UTC-5, Steven D'Aprano wrote: > One day, in my Copious Spare Time, I intend to write a proper feature > request and/or PEP for such a feature. Obviously the absolute earliest > such a feature could be introduced is Python 3.4, about 18 months from > now. (Alt

Re: Tkinter binding question

2012-06-18 Thread rantingrickjohnson
On Monday, June 18, 2012 1:21:02 PM UTC-5, Frederic Rentsch wrote: > Hi All, > > For most of an afternoon I've had that stuck-in-a-dead-end feeling > probing to no avail all permutations formulating bindings, trying to > make sense of manuals and tutorials. Here are my bindings: > >label_

"constant sharing" works differently in REPL than in script ?

2012-06-18 Thread shearichard
Listening to 'Radio Free Python' episode 8 (http://radiofreepython.com/episodes/8/ - around about the 30 minute mark) I heard that Python pre creates some integer constants to avoid a proliferation of objects with the same value. I was interested in this and so I decided to try it out. First I

Re: Checking compatibility of a script across Python versions automatically

2012-06-18 Thread Terry Reedy
On 6/18/2012 3:24 PM, Andrew Berg wrote: Are there any tools out there that will parse a script and tell me if it is compatible with an arbitrary version of Python and highlight any Not that I know of. incompatibilities? I need to check a few of my scripts that target 3.2 to see if I can make

Re: Conditional decoration

2012-06-18 Thread Rob Williscroft
Roy Smith wrote in news:jro9cj$b44$1...@panix2.panix.com in gmane.comp.python.general: > Is there any way to conditionally apply a decorator to a function? > For example, in django, I want to be able to control, via a run-time > config flag, if a view gets decorated with @login_required(). > > @

Re: Conditional decoration

2012-06-18 Thread Devin Jeanpierre
On Mon, Jun 18, 2012 at 6:49 PM, Emile van Sebille wrote: > On 6/18/2012 3:16 PM Roy Smith said... > class myDecorator(object): >    def __init__(self, f): >        self.f = f >    def __call__(self): >        print "Entering", self.f.__name__ >        self.f() >        print "Exited", self.f.__na

Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
Which leads me to another question ... how can I debug these things? $ echo 'hello' | python3 -m pdb ~/my-input.py > /home/jason/my-input.py(2)() -> import sys (Pdb) *** NameError: name 'hello' is not defined -- http://mail.python.org/mailman/listinfo/python-list

Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
> sys.stdin wraps a buffered reader which itself wraps a raw file reader. > sys.stdin > <_io.TextIOWrapper name='' mode='r' encoding='UTF-8'> sys.stdin.buffer > <_io.BufferedReader name=''> sys.stdin.buffer.raw > <_io.FileIO name='' mode='rb'> > > You should read from sys.stdin.buffe

Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Christian Heimes
Am 19.06.2012 01:13, schrieb Jason Friedman: > I tried this: sys.stdin wraps a buffered reader which itself wraps a raw file reader. >>> sys.stdin <_io.TextIOWrapper name='' mode='r' encoding='UTF-8'> >>> sys.stdin.buffer <_io.BufferedReader name=''> >>> sys.stdin.buffer.raw <_io.FileIO name='' m

Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 4:13 PM, Jason Friedman wrote: > I tried this: > > Python 3.2.2 (default, Feb 24 2012, 20:07:04) > [GCC 4.6.1] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import sys import io fh = io.open(sys.stdin) > Traceback (most re

Re: lazy evaluation of a variable

2012-06-18 Thread Gelonida N
On 06/17/2012 11:35 PM, Gelonida N wrote: Hi, I'm not sure whether what I ask for is impossible, but would know how others handle such situations. I'm having a module, which should lazily evaluate one of it's variables. Meaning that it is evaluated only if anybody tries to use this variable.

Read STDIN as bytes rather than a string

2012-06-18 Thread Jason Friedman
I tried this: Python 3.2.2 (default, Feb 24 2012, 20:07:04) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> import io >>> fh = io.open(sys.stdin) Traceback (most recent call last): File "", line 1, in TypeError: invalid file: <_io.

Re: Conditional decoration

2012-06-18 Thread Emile van Sebille
On 6/18/2012 3:16 PM Roy Smith said... Is there any way to conditionally apply a decorator to a function? For example, in django, I want to be able to control, via a run-time config flag, if a view gets decorated with @login_required(). @login_required() def my_view(request): pass class

Re: Conditional decoration

2012-06-18 Thread MRAB
On 18/06/2012 23:16, Roy Smith wrote: Is there any way to conditionally apply a decorator to a function? For example, in django, I want to be able to control, via a run-time config flag, if a view gets decorated with @login_required(). @login_required() def my_view(request): pass A decora

Re: Conditional decoration

2012-06-18 Thread Jeremiah Dodds
r...@panix.com (Roy Smith) writes: > Is there any way to conditionally apply a decorator to a function? > For example, in django, I want to be able to control, via a run-time > config flag, if a view gets decorated with @login_required(). > > @login_required() > def my_view(request): > pass Y

Conditional decoration

2012-06-18 Thread Roy Smith
Is there any way to conditionally apply a decorator to a function? For example, in django, I want to be able to control, via a run-time config flag, if a view gets decorated with @login_required(). @login_required() def my_view(request): pass -- http://mail.python.org/mailman/listinfo/python-

Re: python 3.3 bz2 decompression testing results

2012-06-18 Thread Nadeem Vawda
Hi Pauli, Thank you for your interest in improving the bz2 module. However, I'm not sure of what you are saying in your email. If you believe you have found a bug in the module, then please provide clear instructions on how to reproduce the error(s), preferably using just one data file that trigg

Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
On Jun 18, 8:45 pm, Terry Reedy wrote: > On 6/18/2012 12:39 PM, jmfauth wrote: > > > We are turning in circles. > > You are, not we. Please stop. > > > You are somehow legitimating the reintroduction of unicode > > literals > > We are not 'reintroducing' unicode literals. In Python 3, string > lit

Checking compatibility of a script across Python versions automatically

2012-06-18 Thread Andrew Berg
Are there any tools out there that will parse a script and tell me if it is compatible with an arbitrary version of Python and highlight any incompatibilities? I need to check a few of my scripts that target 3.2 to see if I can make them compatible with 3.0 and 3.1 if they aren't already. I found p

Re: module name vs '.'

2012-06-18 Thread Terry Reedy
On 6/18/2012 9:54 AM, Dave Angel wrote: On 06/18/2012 09:47 AM, Neal Becker wrote: I meant a module You are correct that using periods in a module name conflicts with periods in import statement syntax. from src.directory import neal that has nothing to do with periods being in a director

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Terry Reedy
On 6/18/2012 12:39 PM, jmfauth wrote: We are turning in circles. You are, not we. Please stop. You are somehow legitimating the reintroduction of unicode literals We are not 'reintroducing' unicode literals. In Python 3, string literals *are* unicode literals. Other developers reintroduc

Tkinter binding question

2012-06-18 Thread Frederic Rentsch
Hi All, For most of an afternoon I've had that stuck-in-a-dead-end feeling probing to no avail all permutations formulating bindings, trying to make sense of manuals and tutorials. Here are my bindings: label_frame.bind ('', self.color_selected) label_frame.bind ('', self.color_selectab

Re: Hashable object with self references OR how to create a tuple that refers to itself

2012-06-18 Thread Duncan Booth
Dieter Maurer wrote: > You can create a tuple in "C" and then put a reference to itself into > it, but I am quite convinced that you cannot do it in Python itself. > (Of course, you could use "cython" to generate C code with a source > language very similar to Python). I don't think you can even

Re: Problem with ImapLib and subject in French

2012-06-18 Thread Dieter Maurer
Valentin Mercier writes: > I'm trying to search some mails with SUBJECT criteria, but the problem is the > encoding, I'm trying to search french terms (impalib and python V2.7) > > I've tried few things, but I think the encoding is the problem, in my mail > header I have something like this: > >

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Jussi Piitulainen
Andrew Berg writes: > On 6/18/2012 11:32 AM, Jussi Piitulainen wrote: > > jmfauth writes: > > > >> Thinks are very clear to me. I wrote enough interactive > >> interpreters with all available toolkits for Windows > > > r = input() > > u'a > > Traceback (most recent call last): > > File "",

Re: Academic citation of Python

2012-06-18 Thread Ethan Furman
Ben Finney wrote: Curt writes: On 2012-06-16, Christian Heimes wrote: Actually it's "van Rossum, Guido", not "Rossum, Guido van". The "van" is part of the family name, not a middle name. It's like "da Vinci, Leonardo" or "von Sydow, Max". On one occasion Guido complained that Americans alway

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
On 6/18/2012 12:03 PM, Dave Angel wrote: > And you're missing the context. jmfauth thinks we should re-introduce > the input/raw-input distinction so he could parse literal strings. So > Jussi demonstrated that the 2.x input did NOT satisfy fmfauth's dreams. You're right. I missed that part of jm

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Dave Angel
On 06/18/2012 12:55 PM, Andrew Berg wrote: > On 6/18/2012 11:32 AM, Jussi Piitulainen wrote: >> jmfauth writes: >> >>> Thinks are very clear to me. I wrote enough interactive >>> interpreters with all available toolkits for Windows > r = input() >> u'a >> Traceback (most recent call last): >>

Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
We are turning in circles. You are somehow legitimating the reintroduction of unicode literals and I shew, not to say proofed, it may be a source of problems. Typical Python desease. Introduce a problem, then discuss how to solve it, but surely and definitivly do not remove that problem. As far a

Re: Py3.3 unicode literal and input()

2012-06-18 Thread David M Chess
> If you (the programmer) want a function that asks the user to enter a > literal at the input prompt, you'll have to write a post-processing for > it, which looks for prefixes, for quotes, for backslashes, etc., and > encodes the result. There very well may be such a decoder in the Python > libra

Re: Py3.3 unicode literal and input()

2012-06-18 Thread John Roth
On Monday, June 18, 2012 9:44:17 AM UTC-6, jmfauth wrote: > Thinks are very clear to me. I wrote enough interactive > interpreters with all available toolkits for Windows > since I know Python (v. 1.5.6). > > I do not see why the semantic may vary differently > in code source or in an interactive

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
On 6/18/2012 11:32 AM, Jussi Piitulainen wrote: > jmfauth writes: > >> Thinks are very clear to me. I wrote enough interactive >> interpreters with all available toolkits for Windows > r = input() > u'a > Traceback (most recent call last): > File "", line 1, in > SyntaxError: u'a > > Er,

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Jussi Piitulainen
jmfauth writes: > Thinks are very clear to me. I wrote enough interactive > interpreters with all available toolkits for Windows >>> r = input() u'a Traceback (most recent call last): File "", line 1, in SyntaxError: u'a Er, no, not really :-) -- http://mail.python.org/mailman/listinfo/pytho

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Chris Angelico
On Tue, Jun 19, 2012 at 1:44 AM, jmfauth wrote: > I do not see why the semantic may vary differently > in code source or in an interactive interpreter, > esp. if Python allow it! When you're asking for input, you usually aren't looking for code. It doesn't matter about string literal formats, bec

Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
Thinks are very clear to me. I wrote enough interactive interpreters with all available toolkits for Windows since I know Python (v. 1.5.6). I do not see why the semantic may vary differently in code source or in an interactive interpreter, esp. if Python allow it! If you have to know by advance

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Ulrich Eckhardt
Am 18.06.2012 16:00, schrieb jmfauth: > A string is a string, a "piece of text", period. No. There are different representations for the same piece of text even in the context of just Python. b'fou', u'fou', 'fou' are three different source code representations, resulting in two different runtime

Cross-platform mobile application written in Python

2012-06-18 Thread Alex Susu
Hello. I would like to point you to a project that I worked on lately: iCam, a video surveillance cross-platform mobile application (Android, Symbian, iOS, WinCE) written in Python, which uploads normally media to YouTube and Picasa. The project can be found at http://code.google.com/p/icam-mobi

Re: Problem with ImapLib and subject in French

2012-06-18 Thread Arnaud Delobelle
On 18 June 2012 12:31, Valentin Mercier wrote: > Hi, > > I'm trying to search some mails with SUBJECT criteria, but the problem is > the encoding, I'm trying to search french terms (impalib and python V2.7) > > I've tried few things, but I think the encoding is the problem, in my mail > header I h

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Dave Angel
On 06/18/2012 10:00 AM, jmfauth wrote: > > A string is a string, a "piece of text", period. I do not see why a > unicode literal and an (well, I do not know how the call it) a "normal > class " should behave differently in code source or as an answer > to an input(). Wrong. The rules for parsi

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
Perhaps this will clear things up: Python 3.3.0a4 (v3.3.0a4:7c51388a3aa7, May 31 2012, 20:17:41) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ua = u'a' >>> literal_ua = "u'a'" >>> ua == literal_ua False >>> input_ua = input() u'a'

Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
On 18 juin, 12:11, Steven D'Aprano wrote: > On Mon, 18 Jun 2012 02:30:50 -0700, jmfauth wrote: > > On 18 juin, 10:28, Benjamin Kaplan wrote: > >> The u prefix is only there to > >> make it easier to port a codebase from Python 2 to Python 3. It doesn't > >> actually do anything. > > > It does. I

Re: module name vs '.'

2012-06-18 Thread Dave Angel
On 06/18/2012 09:47 AM, Neal Becker wrote: > I meant a module > > src.directory contains > __init__.py > neal.py > becker.py > > from src.directory import neal > > > On Mon, Jun 18, 2012 at 9:44 AM, Dave Angel wrote: > >> On 06/18/2012 09:19 AM, Neal Becker wrote: >>> Am I correct that a modu

Re: module name vs '.'

2012-06-18 Thread Neal Becker
I meant a module src.directory contains __init__.py neal.py becker.py from src.directory import neal On Mon, Jun 18, 2012 at 9:44 AM, Dave Angel wrote: > On 06/18/2012 09:19 AM, Neal Becker wrote: > > Am I correct that a module could never come from a file path with a '.' > in the > > name? >

Re: module name vs '.'

2012-06-18 Thread Dave Angel
On 06/18/2012 09:19 AM, Neal Becker wrote: > Am I correct that a module could never come from a file path with a '.' in > the > name? > No. Simple example: Create a directory called src.directory In that directory, create two files ::neal.py:: import becker print becker.__file__ print becker.h

module name vs '.'

2012-06-18 Thread Neal Becker
Am I correct that a module could never come from a file path with a '.' in the name? -- http://mail.python.org/mailman/listinfo/python-list

Problem with ImapLib and subject in French

2012-06-18 Thread Valentin Mercier
Hi, I'm trying to search some mails with SUBJECT criteria, but the problem is the encoding, I'm trying to search french terms (impalib and python V2.7) I've tried few things, but I think the encoding is the problem, in my mail header I have something like this: =?iso-8859-1?Q?Job:_"Full_Backup_

Re: post init call

2012-06-18 Thread Peter Otten
Prashant wrote: > class Shape(object): > def __init__(self, shapename): > self.shapename = shapename > > > def update(self): > print "update" > > class ColoredShape(Shape): > def __init__(self, color): > Shape.__init__(self, color) > s

Re: post init call

2012-06-18 Thread Thomas Rachel
Am 18.06.2012 09:10 schrieb Prashant: class Shape(object): def __init__(self, shapename): self.shapename = shapename def update(self): print "update" class ColoredShape(Shape): def __init__(self, color): Shape.__init__(self, color) self.color =

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2012 02:30:50 -0700, jmfauth wrote: > On 18 juin, 10:28, Benjamin Kaplan wrote: >> The u prefix is only there to >> make it easier to port a codebase from Python 2 to Python 3. It doesn't >> actually do anything. > > > It does. I shew it! Incorrect. You are assuming that Python

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Steven D'Aprano
On Mon, 18 Jun 2012 01:19:32 -0700, jmfauth wrote: > What is input() supposed to return? Whatever you type. u'a' == 'a' > True This demonstrates that in Python 3.3, u'a' gives a string equal to 'a'. r1 = input(':') > :a Since you typed the letter a, r1 is the string "a" (a single ch

Re: Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
On 18 juin, 10:28, Benjamin Kaplan wrote: > On Mon, Jun 18, 2012 at 1:19 AM, jmfauth wrote: > > What is input() supposed to return? > > u'a' == 'a' > > True > > r1 = input(':') > > :a > r2 = input(':') > > :u'a' > r1 == r2 > > False > type(r1), len(r1) > > (, 1) > ty

Re: post init call

2012-06-18 Thread Ulrich Eckhardt
Am 18.06.2012 09:10, schrieb Prashant: > class Shape(object): > def __init__(self, shapename): > self.shapename = shapename > > > def update(self): > print "update" > > class ColoredShape(Shape): > def __init__(self, color): > Shape.__init__(se

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 1:19 AM, jmfauth wrote: > What is input() supposed to return? > u'a' == 'a' > True r1 = input(':') > :a r2 = input(':') > :u'a' r1 == r2 > False type(r1), len(r1) > (, 1) type(r2), len(r2) > (, 4) > > --- > > sys.argv? > > jmf Python

Py3.3 unicode literal and input()

2012-06-18 Thread jmfauth
What is input() supposed to return? >>> u'a' == 'a' True >>> >>> r1 = input(':') :a >>> r2 = input(':') :u'a' >>> r1 == r2 False >>> type(r1), len(r1) (, 1) >>> type(r2), len(r2) (, 4) >>> --- sys.argv? jmf -- http://mail.python.org/mailman/listinfo/python-list

post init call

2012-06-18 Thread Prashant
class Shape(object): def __init__(self, shapename): self.shapename = shapename def update(self): print "update" class ColoredShape(Shape): def __init__(self, color): Shape.__init__(self, color) self.color = color print 1