RE: AttributeError: 'SSLSocket' object has no attribute 'producer_fifo'

2009-10-22 Thread VYAS ASHISH M-NTB837
Tried using asyncore.dispatcher_with_send in place of asynchat.async_chat and after a few request-responses, I get this: Exception in thread Thread-2: Traceback (most recent call last): File "C:\Python31\lib\threading.py", line 509, in _bootstrap_inner self.run() File "C:\Python31\lib\thr

Re: Help with code = Extract numerical value to variable

2009-10-22 Thread Steve
Sorry I'm not being clear Input** sold: 16 sold: 20 sold: 2 sold: 0 sold: 7 0 sold null Output 16 20 2 0 0 7 0 0 0 0 -- http://mail.python.org/mailman/listinfo/python-list

Re: pyodbc - problem passing None as parameter

2009-10-22 Thread Frank Millman
Tim Golden wrote: > Frank Millman wrote: >> > cur.execute('select * from ctrl.dirusers where todate is ?', None) >> Traceback (most recent call last): >> File "", line 1, in pyodbc.ProgrammingError: ('42000', >> "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax >> ne

AttributeError: 'SSLSocket' object has no attribute 'producer_fifo'

2009-10-22 Thread VYAS ASHISH M-NTB837
I am getting the following error when I try to run my program to post and receive xmls to an https server. Traceback (most recent call last): File "C:\Python31\lib\threading.py", line 509, in _bootstrap_inner self.run() File "C:\Python31\lib\threading.py", line 462, in run self._tar

PAMIE and beautifulsoup problem

2009-10-22 Thread elca
hello, currently im making some web scrap script. and i was choice PAMIE to use my script. actually im new to python and programming. so i have no idea ,if i use PAMIE,it really helpful to make script to relate with win32-python. ok my problem is , while im making script,i was encounter two probel

Re: Help with my program

2009-10-22 Thread Kenny Shen
Indeed, thanks for reminding me of that. The following should suffice: class A: def __init__(self): self.height = 1 self.weight = 7 self.name = "tanner" self.grade = "A" class B: def __init__(self, a): self.info = [a.height, a.weight, a.name, a.grade] prin

Re: Help with my program

2009-10-22 Thread Chris Rebert
Python is not Java. Accessor methods are unnecessary and unidiomatic. Just access the attributes directly. For more on Python not being Java, see: http://dirtsimple.org/2004/12/python-is-not-java.html Cheers, Chris -- http://blog.rebertia.com On Thu, Oct 22, 2009 at 10:07 PM, VYAS ASHISH M-NTB83

RE: Help with my program

2009-10-22 Thread VYAS ASHISH M-NTB837
So What is stopping you to do this? Make some methods getName, getHeight... and call classObj.getName() etc from other class. Ashish From: python-list-bounces+ntb837=motorola@python.org [mailto:python-list-bounces+ntb837=motorola@python.org] On Behalf

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Stephen Hansen
On Thu, Oct 22, 2009 at 9:09 PM, Stephen Hansen wrote: > >>> class myclass(object): > ... def __new__(cls, *args, **kwargs): > ... print args > ... print kwargs > ... self = object.__new__(cls) > ... return self > ... def __init__(self, *args

Re: subprocess executing shell

2009-10-22 Thread Tim Arnold
"Gabriel Genellina" wrote in message news:mailman.1840.1256202325.2807.python-l...@python.org... > En Wed, 21 Oct 2009 12:24:37 -0300, Tim Arnold > escribió: > >> Hi, I'm writing a script to capture a command on the commandline and run >> it >> on a remote server. >> I guess I don't understand

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Carl Banks
On Oct 22, 8:12 pm, rh0dium wrote: > Hi all, > > I have a basic Monostate with Python 2.6. > > class Borg(object): >     __shared_state = {} >     def __new__(cls, *args, **kwargs): >         self = object.__new__(cls, *args, **kwargs) >         self.__dict__ = cls.__shared_state >         return

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Stephen Hansen
On Thu, Oct 22, 2009 at 8:12 PM, rh0dium wrote: > In my case the args that it dumps them into a black hold is simply not > true. I want an unknown set of args and kwargs to simply be forwarded > onto init. So what's the problem with this?? > There is no problem with doing that-- the deprecatio

Re: unicode and dbf files

2009-10-22 Thread Ethan Furman
John Machin wrote: On Oct 23, 7:28 am, Ethan Furman wrote: Greetings, all! I would like to add unicode support to my dbf project. The dbf header has a one-byte field to hold the encoding of the file. For example, \x03 is code-page 437 MS-DOS. My google-fu is apparently not up to the task o

Re: Help with my program

2009-10-22 Thread Kenny Shen
Hi tanner, I suppose the following is possible: class A: def __init__(self): self.height = 1 self.weight = 7 self.name = "tanner" self.grade = "A" def getinfo(self): info = [] info.append(self.name) info.append(self.weight) info.append(self.heig

Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread rh0dium
Hi all, I have a basic Monostate with Python 2.6. class Borg(object): __shared_state = {} def __new__(cls, *args, **kwargs): self = object.__new__(cls, *args, **kwargs) self.__dict__ = cls.__shared_state return self def __init__(self, *args, **kwargs):

Re: structread

2009-10-22 Thread Aahz
In article , Lawrence D'Oliveiro wrote: > >This routine is so useful, I wonder there's nothing like it in module >struct, or anywhere else I'm aware of: > >def structread(fromfile, decode_struct) : >"""reads sufficient bytes from fromfile to be unpacked according to >decode_st

Re: [ANN] Python(x,y) 2.6.3.0 released

2009-10-22 Thread Scott David Daniels
Pierre Raybaut wrote: Hi all, I'm quite pleased (and relieved) to announce that Python(x,y) version 2.6.3.0 has been released. It is the first release based on Python 2.6 -- note that Python(x,y) version number will now follow the included Python version (Python(x,y) vX.Y.Z.N will be based on

multiprocessing deadlock

2009-10-22 Thread Brian Quinlan
My test reduction: import multiprocessing import queue def _process_worker(q): while True: try: something = q.get(block=True, timeout=0.1) except queue.Empty: return else: print('Grabbed item from queue:', something) def _make_som

Help with my program

2009-10-22 Thread tanner barnes
Ok so im in need of some help! I have a program with 2 classes and in one 4 variables are created (their name, height, weight, and grade). What im trying to make happen is to get the variables from the first class and use them in the second class.

Re: Terminating python script easily

2009-10-22 Thread Gabriel Genellina
En Thu, 22 Oct 2009 10:03:51 -0300, Bahadir Balban escribió: On Thu, Oct 22, 2009 at 4:01 PM, Jean-Michel Pichavant wrote: Balban wrote: Often, if I want to terminate the script prematurely, I press ctrl-c, but I have to do this many times before I can kill the script for good. I was wonderi

Re: Terminating python script easily

2009-10-22 Thread Gabriel Genellina
En Thu, 22 Oct 2009 10:03:51 -0300, Bahadir Balban escribió: On Thu, Oct 22, 2009 at 4:01 PM, Jean-Michel Pichavant wrote: Balban wrote: Often, if I want to terminate the script prematurely, I press ctrl-c, but I have to do this many times before I can kill the script for good. I was wonderi

Re: Unloading a module

2009-10-22 Thread Gabriel Genellina
En Thu, 22 Oct 2009 11:59:58 -0300, lallous escribió: If a reference to an imported module reaches zero will Python cleanup everything related to that module and unload the compiled code, etc, etc...? The module object itself (as any other object whose reference count reaches zero) will be

Re: a splitting headache

2009-10-22 Thread Gabriel Genellina
En Thu, 22 Oct 2009 19:45:54 -0300, Mensanator escribió: On Oct 22, 4:35 pm, John Posner wrote: Mensanator wrote: > That's interesting. If string.splitfields(delim) was equivalent to > str.split(sep), it would have been useful to add the phrase > "str.split(sep) is equivalent to the old strin

python pyodbc - connect error

2009-10-22 Thread Threader Slash
Hi again.. I have done the same test using pyodbc, but to MySQL ODBC driver. It works fine for MySQL. The problem still remains to Lotus Notes. Any other hints please? -- http://mail.python.org/mailman/listinfo/python-list

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2009-10-22 Thread Aahz
In article , John O'Hagan wrote: >On Mon, 19 Oct 2009, Aahz wrote: >> In article , >> John O'Hagan wrote: >>> >>>I'm getting input for a program while it's running by using raw_input in a >>>loop in separate thread. This works except for the inconvenience of not >>> having a command history or t

Re: What am I doing wrong with SWIG in OS X Snow Leopard?

2009-10-22 Thread Aahz
In article <75798c2a-44da-4c58-917c-7a41537c5...@y32g2000prd.googlegroups.com>, Zectbumo wrote: > >Here are the steps I am doing that cause me to get the error >ImportError: No module named _hi. >I'm running OS X 10.6.1 What am I doing wrong? You probably want to ask on pythonmac-sig -- Aahz (a

Re: Terminating python script easily

2009-10-22 Thread Cameron Simpson
On 22Oct2009 16:03, Bahadir Balban wrote: | On Thu, Oct 22, 2009 at 4:01 PM, Jean-Michel Pichavant | wrote: | > Balban wrote: | >> I have a python build script that calls various commands, some using | >> os.system(). | >> | >> Often, if I want to terminate the script prematurely, I press ctrl-c,

Re: Unicode again ... default codec ...

2009-10-22 Thread Wolodja Wentland
On Thu, Oct 22, 2009 at 13:59 +0200, Lele Gaifax wrote: > "Gabriel Genellina" writes: >> unittest, or ultimately, this bug: http://bugs.python.org/issue4947 > http://bugs.python.org/issue4947#msg87637 as the best fit, I think You might also want to have a look at: http://bugs.python.org/iss

Re: unicode and dbf files

2009-10-22 Thread John Machin
On Oct 23, 7:28 am, Ethan Furman wrote: > Greetings, all! > > I would like to add unicode support to my dbf project.  The dbf header > has a one-byte field to hold the encoding of the file.  For example, > \x03 is code-page 437 MS-DOS. > > My google-fu is apparently not up to the task of locating

Re: Please help with regular expression finding multiple floats

2009-10-22 Thread Cousin Stanley
> I have text that looks like the following > (but all in one string with '\n' separating the lines): > > > I want to capture the two or three floating point numbers in each line > and store them in a tuple. > > I have the regular expression pattern > Jeremy For a non-r

Re: Help with code = Extract numerical value to variable

2009-10-22 Thread rurpy
Sorry, I still don't understand. I gather you don't literally want a "0" output for every line that does not contain a number since then your output would be, 0, 0, 16, 20, ... (I'm assuming you want to ignore the "6" in "In Field6") which does not match your sample output. Do you mean, for every

PySerial

2009-10-22 Thread Ronn Ross
I'm using pySerial to connect to a serial port (rs232) on a windows xp machine. I'm using python interactive interpretor to interact with the device. I type the following: import serial ser = serial.Serial(2) ser.write("command") But this does nothing to the control. I have been able to connect vi

python pyodbc - connect error

2009-10-22 Thread Threader Slash
Hello Everybody... here we go - my question: 1. I am using Eclipse IDE with Python 2.5 and pyodbc25 - winXP; need to read content from a Lotus Notes database, so run some basic query like - SELECT personname FROM tablename. 2. 'import pyodbc' is ok - python see it! 3. But it doesn't connect, when

Re: Please help with regular expression finding multiple floats

2009-10-22 Thread Rhodri James
On Thu, 22 Oct 2009 23:26:01 +0100, Jeremy wrote: I have text that looks like the following (but all in one string with '\n' separating the lines): 1.E-08 1.58024E-06 0.0048 [snip] 5.E+00 2.42717E-05 0.0017 total 1.93417E-04 0.0012 I want to capture the two or

Re: Parsing a large number of parms to a print statement.

2009-10-22 Thread KB
Excuse the top-post, but thanks to all, the tuple was the way to go. On Oct 22, 2:16 pm, KB wrote: > Hi, > > I have to pass over 150 parameters to a print statement ala: > > print "%s %s %s <150'th unique text> %s" % (v > [0], v[1], ... v[150]) > > I can't use a for loop like I normally wou

Re: a splitting headache

2009-10-22 Thread Mensanator
On Oct 22, 4:35 pm, John Posner wrote: > [resend, with Subject line corrected and formatting crud deleted] > > Mensanator wrote: > > That's interesting. If string.splitfields(delim) was equivalent to > > str.split(sep), it would have been useful to add the phrase > > "str.split(sep) is equivalent

Re: Help with code = Extract numerical value to variable

2009-10-22 Thread Steve
If there is a number in the line I want the number otherwise I want a 0 I don't think I can use strip because the lines have no standards Thanks again Steve On Oct 22, 1:53 pm, ru...@yahoo.com wrote: > On Oct 22, 11:27 am, Steve wrote: > > > > > > > I have some data that I'm performing some ana

Please help with regular expression finding multiple floats

2009-10-22 Thread Jeremy
I have text that looks like the following (but all in one string with '\n' separating the lines): 1.E-08 1.58024E-06 0.0048 1.E-07 2.98403E-05 0.0018 1.E-06 8.85470E-06 0.0026 1.E-05 6.08120E-06 0.0032 1.E-03 1.61817E-05 0.0022 1.E+00 8.3

Re: Parsing a large number of parms to a print statement.

2009-10-22 Thread Andre Engels
On Thu, Oct 22, 2009 at 11:16 PM, KB wrote: > Hi, > > I have to pass over 150 parameters to a print statement ala: > > print "%s %s %s <150'th unique text> %s" % (v > [0], v[1], ... v[150]) > > I can't use a for loop like I normally would over the list "v" due to > the different text fragmen

Re: a splitting headache

2009-10-22 Thread John Posner
[resend, with Subject line corrected and formatting crud deleted] Mensanator wrote: That's interesting. If string.splitfields(delim) was equivalent to str.split(sep), it would have been useful to add the phrase "str.split(sep) is equivalent to the old string.splitfields(delim) which no longer ex

Re: Parsing a large number of parms to a print statement.

2009-10-22 Thread Paul Rubin
KB writes: > I have to pass over 150 parameters to a print statement ala: > > print "%s %s %s <150'th unique text> %s" % (v > [0], v[1], ... v[150]) > > I can't use a for loop like I normally would over the list "v" due to > the different text fragments between each var. print "%s ..." %

Re: Parsing a large number of parms to a print statement.

2009-10-22 Thread Benjamin Kaplan
On Thu, Oct 22, 2009 at 5:16 PM, KB wrote: > Hi, > > I have to pass over 150 parameters to a print statement ala: > > print "%s %s %s <150'th unique text> %s" % (v > [0], v[1], ... v[150]) > > I can't use a for loop like I normally would over the list "v" due to > the different text fragment

Re: Parsing a large number of parms to a print statement.

2009-10-22 Thread MRAB
KB wrote: Hi, I have to pass over 150 parameters to a print statement ala: print "%s %s %s <150'th unique text> %s" % (v [0], v[1], ... v[150]) I can't use a for loop like I normally would over the list "v" due to the different text fragments between each var. Is there a lambda function

Re:

2009-10-22 Thread John Posner
Mensanator wrote: That's interesting. If string.splitfields(delim) was equivalent to str.split(sep), it would have been useful to add the phrase "str.split(sep) is equivalent to the old string.splitfields(delim) which no longer exists." to the docs. That way, a search on "splitfields" would direc

Re: Parsing a large number of parms to a print statement.

2009-10-22 Thread Ethan Furman
KB wrote: Hi, I have to pass over 150 parameters to a print statement ala: print "%s %s %s <150'th unique text> %s" % (v [0], v[1], ... v[150]) I can't use a for loop like I normally would over the list "v" due to the different text fragments between each var. Is there a lambda function

Parsing a large number of parms to a print statement.

2009-10-22 Thread KB
Hi, I have to pass over 150 parameters to a print statement ala: print "%s %s %s <150'th unique text> %s" % (v [0], v[1], ... v[150]) I can't use a for loop like I normally would over the list "v" due to the different text fragments between each var. Is there a lambda function I can use i

Re: a simple unicode question

2009-10-22 Thread Gabriel Genellina
En Thu, 22 Oct 2009 17:08:21 -0300, escribió: On 10/22/2009 03:23 AM, Gabriel Genellina wrote: En Wed, 21 Oct 2009 15:14:32 -0300, escribió: On Oct 21, 4:59 am, Bruno Desthuilliers wrote: beSTEfar a écrit : (snip) > When parsing strings, use Regular Expressions. And now you have _two_ p

Re: Windows file paths, again

2009-10-22 Thread Matt McCredie
Dan Guido gmail.com> writes: > > Hi Anthony, > > Thanks for your reply, but I don't think your tests have any control > characters in them. Try again with a \v, a \n, or a \x in your input > and I think you'll find it doesn't work as expected. > > -- > Dan Guido Why don't you try it yourself

Re: Python socket won't connect on Windows

2009-10-22 Thread Florian Berger
Hi Grant, thanks for the reply! > I'd probably fire up Wireshark and capture the network traffic > to/from the remote host when the Python app attempts to connect > and when another client connects. Yes, low level traffic analyzing would have been the next logical step. However, mysteriously thi

unicode and dbf files

2009-10-22 Thread Ethan Furman
Greetings, all! I would like to add unicode support to my dbf project. The dbf header has a one-byte field to hold the encoding of the file. For example, \x03 is code-page 437 MS-DOS. My google-fu is apparently not up to the task of locating a complete resource that has a list of the 256 p

Re: Cpython optimization

2009-10-22 Thread geremy condra
On Wed, Oct 21, 2009 at 1:28 PM, Qrees wrote: > Hello > > As my Master's dissertation I chose Cpython optimization. That's why > i'd like to ask what are your suggestions what can be optimized. Well, > I know that quite a lot. I've downloaded the source code (I plan to > work on Cpython 2.6 and I'

Re: a simple unicode question

2009-10-22 Thread rurpy
On 10/22/2009 03:23 AM, Gabriel Genellina wrote: > En Wed, 21 Oct 2009 15:14:32 -0300, escribió: > >> On Oct 21, 4:59 am, Bruno Desthuilliers > 42.desthuilli...@websiteburo.invalid> wrote: >>> beSTEfar a écrit : >>> (snip) >>> > When parsing strings, use Regular Expressions. >>> >>> And now you h

Re: subprocess executing shell

2009-10-22 Thread Nobody
On Wed, 21 Oct 2009 11:24:37 -0400, Tim Arnold wrote: > Hi, I'm writing a script to capture a command on the commandline and run it > on a remote server. > I guess I don't understand subprocess because the code below exec's the > user's .cshrc file even though by default shell=False in the Popen

Re: a splitting headache

2009-10-22 Thread rurpy
On 10/22/2009 06:32 AM, David C. Ullrich wrote: > On Wed, 21 Oct 2009 22:47:24 -0700 (PDT), Carl Banks > wrote: > >>On Oct 21, 12:46 pm, David C Ullrich wrote: >>> On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: >>> > On Oct 20, 1:51 pm, David C Ullrich wrote: >>> > I'm not saying either b

Re: a splitting headache

2009-10-22 Thread rurpy
On 10/22/2009 07:17 AM, David C. Ullrich wrote: > On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator > wrote: > >>On Oct 21, 2:46 pm, David C Ullrich wrote: >>> On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: >>> > On Oct 20, 1:51 pm, David C Ullrich wrote: >>> >> On Thu, 15 Oct 2009 18:

Re: Cpython optimization

2009-10-22 Thread Stefan Behnel
Qrees wrote: >> http://www.cython.org/ > > I was thinking about sacrificing some flexibility of Python and thank > you for pointing me to this project. I didn't about it. > [...] > BTW: My seminar deals with object oriented programming. It's actually not hard to extend the set of optimisations in

Re: Cpython optimization

2009-10-22 Thread Stefan Behnel
Francesco Bochicchio wrote: > As a simple and plain python user, I would value a version of cython that > can be used to built faster executables out of almost-python code (that > is python code with a few additional restructions). Maybe using typing > inference to avoid declaring explicitely th

Re: Help with code = Extract numerical value to variable

2009-10-22 Thread rurpy
On Oct 22, 11:27 am, Steve wrote: > I have some data that I'm performing some analysis on. > How do I grab the numerical value if it's present and ignore > otherwise. So in the following example > I would have assign the following values to my var > 16 > 20 > 2 > 7 > 0 > > In Field6 > Sample Strin

Re: Help with code = Extract numerical value to variable

2009-10-22 Thread Peter Pearson
On Thu, 22 Oct 2009 10:27:57 -0700 (PDT), Steve wrote: > I have some data that I'm performing some analysis on. > How do I grab the numerical value if it's present and ignore > otherwise. So in the following example > I would have assign the following values to my var > 16 > 20 > 2 > 7 > 0 > > > In

Re: a splitting headache

2009-10-22 Thread Mensanator
On Oct 22, 10:05 am, John Posner wrote: > Carl Banks wrote: > > > > > s.split() and s.split(sep) do different things, and there is no string > > sep that can make s.split(sep) behave like s.split().  That's not > > unheard of but it does go against our typical expectations.  It would > > have bee

Re: a splitting headache

2009-10-22 Thread Mensanator
On Oct 22, 8:17 am, David C. Ullrich wrote: > On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator > > > > > > wrote: > >On Oct 21, 2:46 pm, David C Ullrich wrote: > >> On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: > >> > On Oct 20, 1:51 pm, David C Ullrich wrote: > >> >> On Thu, 15 Oct

Re: Supporting "homework" (was: Re: Checking a Number for Palindromic Behavior)

2009-10-22 Thread rurpy
On 10/22/2009 02:24 AM, Andre Engels wrote: > On Thu, Oct 22, 2009 at 7:04 AM, Dieter Maurer wrote: >> Steven D'Aprano writes on 20 Oct >> 2009 05:35:18 GMT: >>> As far as I'm concerned, asking for help on homework without being honest >>> up-front about it and making an effort first, is cheatin

fastcgi Access Checking

2009-10-22 Thread Robin Becker
I'm trying to do FastCgiAccessChecker with a django project; the base idea is to use the django controlled logins to control access to an apache down load area. My original idea was to make django responsible for the FastCgiAccessChecker script itself since we're running django as an external f

Re: Python socket won't connect on Windows

2009-10-22 Thread Grant Edwards
On 2009-10-22, Florian Berger wrote: > I think I narrowed it down to the fact that Python 2.x on > WinXP won't connect in this setup. > > Does anyone have a hint what to do? I'd probably fire up Wireshark and capture the network traffic to/from the remote host when the Python app attempts to con

Re: a splitting headache

2009-10-22 Thread John Posner
Carl Banks wrote: s.split() and s.split(sep) do different things, and there is no string sep that can make s.split(sep) behave like s.split(). That's not unheard of but it does go against our typical expectations. It would have been a better library design if s.split() and s.split(sep) were d

Unloading a module

2009-10-22 Thread lallous
Hello Group, If a reference to an imported module reaches zero will Python cleanup everything related to that module and unload the compiled code, etc, etc...? For example: import sys m = [__import__(str(x)) for x in xrange(1,4)] del sys.modules['1'] del m[0] print m Is module['1'] really un

Re: pyodbc - problem passing None as parameter

2009-10-22 Thread Tim Golden
Frank Millman wrote: I posted the following to the pyodbc google group, but got no reply - it seems a bit quiet there. I hope someone here can help. I am using pyodbc version 2.1.6 on Windows Server 2003, connecting to Sql Server 2005. This works - cur.execute('select ?', None) cur.fetc

Re: Object Relational Mappers are evil (a meditation)

2009-10-22 Thread J Kenneth King
Aaron Watters writes: > On Oct 16, 10:35 am, mario ruggier wrote: >> On Oct 5, 4:25 pm, Aaron Watters wrote: >> >> > Occasionally I fantasize about making a non-trivial change >> > to one of these programs, but I strongly resist going further >> > than that because the ORM meatgrinder makes it

pyodbc - problem passing None as parameter

2009-10-22 Thread Frank Millman
Hi all I posted the following to the pyodbc google group, but got no reply - it seems a bit quiet there. I hope someone here can help. I am using pyodbc version 2.1.6 on Windows Server 2003, connecting to Sql Server 2005. This works - >>> cur.execute('select ?', None) >>> cur.fetchall() [(No

Re: equivalent to globals(), locals() for nonlocal variables?

2009-10-22 Thread Lie Ryan
geremy condra wrote: I decided to play around with nonlocal declarations today, and was somewhat surprised when a call to nonlocals() resulted in 'nonlocals is not defined'. Is there an a standard equivalent to globals() or locals() for variables in outer nested scopes? Geremy Condra Not that

Re: bad operand type for unary +: tuple

2009-10-22 Thread Frank Millman
Diez B. Roggisch wrote: > Frank Millman wrote: > >> > t = ('a', 'b', 'c') > t2 = 'x', + t[1:] >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: bad operand type for unary +: 'tuple' > >> > > the operator precedence. Sure you want to write > > (a, -b, c) > >

Re: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread D'Arcy J.M. Cain
On Thu, 22 Oct 2009 10:56:07 + baboucarr sanneh wrote: > > By the way, the convention on this list is to bottom-post, > > okay i got that will be doing so from now on :)thnx Thanks but what the previous poster forgot to mention was that you should also trim the text that you are replying

attribute access and indirection

2009-10-22 Thread Ethan Furman
Greetings, List! Say I have an old-fashioned dbf style table, with a single name field of 50 characters: names = dbf.Table(':memory:', 'name C(40)') Then I add a bunch of names from who-knows-where: for name in some_iterable(): names.append((name)) Now I want to know how many start wi

Re: unittest wart/bug for assertNotEqual

2009-10-22 Thread Ethan Furman
Gabriel Genellina wrote: En Tue, 20 Oct 2009 19:57:19 -0300, Ethan Furman escribió: Steven D'Aprano wrote: On Tue, 20 Oct 2009 14:45:49 -0700, Zac Burns wrote: My preference would be that failIfEqual checks both != and ==. This is practical, and would benefit almost all use cases. If "!="

Re: bad operand type for unary +: tuple

2009-10-22 Thread Diez B. Roggisch
Frank Millman wrote: > Hi all > > This is just out of curiosity. > > I have a tuple, and I want to create a new tuple with a new value in the > first position, and everything else unchanged. > > I figured out that this would work - > t = ('a', 'b', 'c') t2 = ('x',) + t[1:] t2 >

Re: a splitting headache

2009-10-22 Thread David C . Ullrich
On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator wrote: >On Oct 21, 2:46 pm, David C Ullrich wrote: >> On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: >> > On Oct 20, 1:51 pm, David C Ullrich wrote: >> >> On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote: >> >> > All I wanted to do

bad operand type for unary +: tuple

2009-10-22 Thread Frank Millman
Hi all This is just out of curiosity. I have a tuple, and I want to create a new tuple with a new value in the first position, and everything else unchanged. I figured out that this would work - >>> t = ('a', 'b', 'c') >>> t2 = ('x',) + t[1:] >>> t2 ('x', 'b', 'c') Then I thought I would neat

Re: a splitting headache

2009-10-22 Thread Mensanator
On Oct 22, 7:47�am, David C. Ullrich wrote: > On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator > > > > > > wrote: > >On Oct 21, 2:46�pm, David C Ullrich wrote: > >> On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: > >> > On Oct 20, 1:51�pm, David C Ullrich wrote: > >> >> On Thu, 15 Oct

Re: Terminating python script easily

2009-10-22 Thread Bahadir Balban
On Thu, Oct 22, 2009 at 4:01 PM, Jean-Michel Pichavant wrote: > Balban wrote: >> >> Hi, >> >> I have a python build script that calls various commands, some using >> os.system(). >> >> Often, if I want to terminate the script prematurely, I press ctrl-c, >> but I have to do this many times before

Re: Terminating python script easily

2009-10-22 Thread Jean-Michel Pichavant
Balban wrote: Hi, I have a python build script that calls various commands, some using os.system(). Often, if I want to terminate the script prematurely, I press ctrl-c, but I have to do this many times before I can kill the script for good. I was wondering is there a way that I define a signal

Re: Terminating python script easily

2009-10-22 Thread Benjamin Kaplan
On Thu, Oct 22, 2009 at 8:46 AM, Balban wrote: > Hi, > > I have a python build script that calls various commands, some using > os.system(). > > Often, if I want to terminate the script prematurely, I press ctrl-c, > but I have to do this many times before I can kill the script for > good. I was w

Re: a splitting headache

2009-10-22 Thread David C . Ullrich
On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator wrote: >On Oct 21, 2:46 pm, David C Ullrich wrote: >> On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: >> > On Oct 20, 1:51 pm, David C Ullrich wrote: >> >> On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote: >> >> > All I wanted to do

Terminating python script easily

2009-10-22 Thread Balban
Hi, I have a python build script that calls various commands, some using os.system(). Often, if I want to terminate the script prematurely, I press ctrl-c, but I have to do this many times before I can kill the script for good. I was wondering is there a way that I define a signal handler and kil

Re: a splitting headache

2009-10-22 Thread David C . Ullrich
On Wed, 21 Oct 2009 22:47:24 -0700 (PDT), Carl Banks wrote: >On Oct 21, 12:46 pm, David C Ullrich wrote: >> On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: >> > On Oct 20, 1:51 pm, David C Ullrich wrote: >> > I'm not saying either behaviour is wrong, it's just not obvious that the >> > on

Re: Passing values from html to python

2009-10-22 Thread Richard Brodie
"Albert Hopkins" wrote in message news:mailman.1851.1256208328.2807.python-l...@python.org... > On Thu, 2009-10-22 at 10:44 +0200, Ahmed Barakat wrote: >> Hi guys, >> >> I am playing with google app engine, I have this situation: >> >> I have a text box in an html page, I want to get the value i

Re: Unicode again ... default codec ...

2009-10-22 Thread Lele Gaifax
"Gabriel Genellina" writes: > En Thu, 22 Oct 2009 05:25:16 -0300, Lele Gaifax > escribió: >> Who is the culprit here? > > unittest, or ultimately, this bug: http://bugs.python.org/issue4947 Thank you. In particular I found http://bugs.python.org/issue4947#msg87637 as the best fit, I think that

Re: Fallen Sword

2009-10-22 Thread Richard Riley
Ben Finney writes: > Richard Riley writes: > >> Ben Finney writes: >> > Reported to service provider as spam. >> >> Please don't reply to SPAM. You just make it visible to those of us >> with better filters. Hint : spammers do not read your reply. > > I didn't quote the spam except to be clear

Re: Text file to XML representation

2009-10-22 Thread Jorgen Grahn
On Wed, 2009-10-21, kak...@gmail.com wrote: > Hello, > I would like to make a program that takes a text file with the > following representation: > > outlook = sunny > | humidity <= 70: yes (2.0) > | humidity > 70: no (3.0) > outlook = overcast: yes (4.0) > outlook = rainy > | windy = TRUE: n

pexpect maxread problem

2009-10-22 Thread Bojan Sukalo
I want to collect the the information from cisco devices through ssh. Using pexpect logout method seems good but maxread attribute is limited to 1168 characters. Allthough I set it to 2000, when I do show running-config on cisco router output comes to the logfile until the 1168 character is reac

Re:

2009-10-22 Thread Tim Golden
baboucarr sanneh wrote: I want to make a script that can copy files and folders from one location and paste it to another location.. e.g from c:\test to d:\test Have a look at the shutil module TJG -- http://mail.python.org/mailman/listinfo/python-list

[no subject]

2009-10-22 Thread baboucarr sanneh
Hi guys I want to make a script that can copy files and folders from one location and paste it to another location.. e.g from c:\test to d:\test thanks regrads $LIM $...@dy _ Windows L

Python socket won't connect on Windows

2009-10-22 Thread Florian Berger
Hi, I have an annoying problem connecting to a remote host via the socket module from Python 2.5 / 2.6 on WinXP. :-( Short description - socket.connect(("host", port)) times out with socket.error 10060, while other applications on the same box can connect to the remote site with

Re: Re-enabling a logger

2009-10-22 Thread Jean-Michel Pichavant
jorma kala wrote: Hi, I'm using the logging module. At one point in my code I disable logging like this: logging.disable(logging.INFO) But how can I enable the logging again further on? I've tried the following, which doesn't work for re-enabling the logger: my_logger.setLevel(logging.INF

Re-enabling a logger

2009-10-22 Thread jorma kala
Hi, I'm using the logging module. At one point in my code I disable logging like this: logging.disable(logging.INFO) But how can I enable the logging again further on? I've tried the following, which doesn't work for re-enabling the logger: my_logger.setLevel(logging.INFO) I've also tried to d

RE: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread baboucarr sanneh
$LIM $...@dy > Date: Thu, 22 Oct 2009 11:51:08 +0100 > From: m...@timgolden.me.uk > CC: python-list@python.org > Subject: Re: Date strftime('%d%m%y') date to be of yesterday > > baboucarr sanneh wrote: > > > > Hi tim > > > > Thank you very much ...I have got it now..now i can continue wi

Re: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread Tim Golden
baboucarr sanneh wrote: Hi tim Thank you very much ...I have got it now..now i can continue with the backup script i want to make By the way, the convention on this list is to bottom-post, that is to add your comments / reply to the bottom of the post you're replying to. These things vary

RE: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread baboucarr sanneh
Hi tim Thank you very much ...I have got it now..now i can continue with the backup script i want to make $LIM $...@dy > Date: Thu, 22 Oct 2009 11:36:50 +0100 > From: m...@timgolden.me.uk > CC: python-list@python.org > Subject: Re: Date strftime('%d%m%y') date to be of yesterday > > babou

Re: Passing values from html to python

2009-10-22 Thread Albert Hopkins
On Thu, 2009-10-22 at 10:44 +0200, Ahmed Barakat wrote: > Hi guys, > > I am new to python and wed-development, I managed to have some nice > example running up till now. > I am playing with google app engine, I have this situation: > > I have a text box in an html page, I want to get the value in

Re: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread Tim Golden
baboucarr sanneh wrote: Hi tim, well i tried what your script but i do have an error import datetime yesterday = datetime.date.today () - datetime.timedelta (days=1) print yesterday.strftime ("%d%m%y") SyntaxError: invalid syntax (, line 1) when i jus check the variable i.e yesterday i do ge

RE: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread baboucarr sanneh
Hi tim, well i tried what your script but i do have an error >>> import datetime >>> yesterday = datetime.date.today () - datetime.timedelta (days=1) >>> print yesterday.strftime ("%d%m%y") SyntaxError: invalid syntax (, line 1) when i jus check the variable i.e yesterday i do get the out put b

  1   2   >