Mixing different interpreters in the same program

2009-10-22 Thread Jaime Buelta
Hello: I keep thinking from some time ago in how to conect two or more Python interpreters. This began as interest in calling Java code from C program, which was solved (at the time) using an intermediate file. But having CPython and Jython, I think it would be great to call a function from,

Re: How to write a facebook client?

2009-10-22 Thread holmes86
On Oct 22, 10:42 am, geremy condra wrote: > On Wed, Oct 21, 2009 at 9:45 PM, holmes86 wrote: > > Hi,everyone > > > I'm a python newbie,and I want to write a facebook client.But I don't > > know how to do it.Meanwhile I have any write web experience,so I also > > don't know how to analyse web page

Re: unittest wart/bug for assertNotEqual

2009-10-22 Thread Gabriel Genellina
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 "!=" isn't "not ==" (IEEE NaNs

Re: which "dictionary with attribute-style access"?

2009-10-22 Thread baloan
On Oct 22, 6:34 am, "Gabriel Genellina" wrote: > > class AttrDict(dict): > >      """A dict whose items can also be accessed as member variables.""" > >      def __init__(self, *args, **kwargs): > >          dict.__init__(self, *args, **kwargs) > >          self.__dict__ = self > > >      def copy

form have 2 iframe.problem to input text in other iframe

2009-10-22 Thread elca
hello, i have some form which split by iframe. subject field is no probelm ,but content field was come from another iframe source.. so i can't input text in content's field.. im using PAMIE and win32com module.. i have to put text in 'contents.contentsValue' here. but i have no luck..anyone can h

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

2009-10-22 Thread Dieter Maurer
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 cheating by breaking the > social contract. Anyone who rewards cheaters by giving them the answer > they want is pa

Cpython optimization

2009-10-22 Thread Qrees
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've downloaded 2.6.3 release). By looking at the code I've

Re: Checking a Number for Palindromic Behavior

2009-10-22 Thread Steven D'Aprano
On Wed, 21 Oct 2009 22:53:29 -0700, rurpy wrote: > On 10/21/2009 03:13 PM, Lie Ryan wrote: >> > [email protected] wrote: >>> >> On 10/21/2009 01:40 AM, Lie Ryan wrote: > [...] >>> As a metaphor, which one do you think is better in the long term: >>> charities or microcredits? >>> >> >>> >>

Re: Checking a Number for Palindromic Behavior

2009-10-22 Thread rurpy
On 10/21/2009 03:13 PM, Lie Ryan wrote: > > [email protected] wrote: >> >> On 10/21/2009 01:40 AM, Lie Ryan wrote: [...] >>> >>> As a metaphor, which one do you think is better in the long term: >>> >>> charities or microcredits? >> >> >> >> Both of course. Why on earth would anyone think there >> >

Re: Checking a Number for Palindromic Behavior

2009-10-22 Thread rurpy
On 10/22/2009 12:35 AM, Steven D'Aprano wrote: > On Wed, 21 Oct 2009 22:53:29 -0700, rurpy wrote: > >> On 10/21/2009 03:13 PM, Lie Ryan wrote: >>> > [email protected] wrote: >> On 10/21/2009 01:40 AM, Lie Ryan wrote: >> [...] > >>> As a metaphor, which one do you think is better in the long

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

2009-10-22 Thread Stephen Hansen
On Wed, Oct 21, 2009 at 10:04 PM, 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 cheating by breaking the > > social contract. Anyone w

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

2009-10-22 Thread Andre Engels
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 cheating by breaking the >> social contract. Anyone who r

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

2009-10-22 Thread Lele Gaifax
"Gabriel Genellina" writes: > En Wed, 21 Oct 2009 06:24:55 -0300, Lele Gaifax > escribió: > >> "Gabriel Genellina" writes: >> > nosetest should do nothing special. You should configure the environment > so Python *knows* that your console understands utf-8. Once Python is > aware of the *real*

Passing values from html to python

2009-10-22 Thread Ahmed Barakat
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 it and pass it to the python script to process it I can pass values f

Re: PyQt4 - remember widget positions

2009-10-22 Thread nusch
On Oct 22, 4:05 am, TerryP wrote: > On Oct 21, 9:04 pm, nusch wrote: > > > Is there any simple command which allows me to save position of all > > windows:  QMainWindow, QDialogs and qdockwidgets with their sizes, > > dock state and positions ? Or do I need to store those values > > manually, how

Re: Frameworks

2009-10-22 Thread Bruno Desthuilliers
Emmanuel Surleau a écrit : It still manages to retain flexibility, but you're basically stuck with Django's ORM You're by no way "stuck" with Django's ORM - you are perfectly free not to use it. But then you'll obviously loose quite a lot of useful features and 3rd part apps... You lose most of

Re: subprocess executing shell

2009-10-22 Thread Gabriel Genellina
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 subprocess because the code below exec's the user's .cshrc file even though by default shell=False in the Popen

Re: a simple unicode question

2009-10-22 Thread Gabriel Genellina
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_ problems For some simple parsing problems, Python's string methods are powerful enough to make REs

Re: PyQt4 - remember widget positions

2009-10-22 Thread Jeremy Sanders
nusch wrote: > Is there any simple command which allows me to save position of all > windows: QMainWindow, QDialogs and qdockwidgets with their sizes, > dock state and positions ? Or do I need to store those values > manually, how can I do it fast? You can use saveState() from QMainWindow to sav

A new way to configure Python logging

2009-10-22 Thread Vinay Sajip
If you use the logging package but don't like using the ConfigParser-based configuration files which it currently supports, keep reading. I'm proposing to provide a new way to configure logging, using a Python dictionary to hold configuration information. It means that you can convert a text file s

Re: a simple unicode question

2009-10-22 Thread Chris Jones
On Wed, Oct 21, 2009 at 12:35:11PM EDT, Nobody wrote: [..] > Characters outside the 16-bit range aren't supported on all builds. > They won't be supported on most Windows builds, as Windows uses 16-bit > Unicode extensively: I knew nothing about UTF-16 & friends before this thread. Best part of

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

2009-10-22 Thread baboucarr sanneh
Hi all I want to output the date of the with this format strftime('%d%m%y') but the date ie '%d' should be the date of yesterday eg import time strftime('%d%m%y') # something like minus a day.. Thank you..am a newbie to python

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

2009-10-22 Thread Tim Golden
baboucarr sanneh wrote: Hi all I want to output the date of the with this format strftime('%d%m%y') but the date ie '%d' should be the date of yesterday eg import time strftime('%d%m%y') # something like minus a day.. Thank you..am a newbie to python import datetime yesterday = datetime.d

buggy popup

2009-10-22 Thread Vinay Sagar Prakash
Hi All, Need some idea here: On my windows machine, there is a Java based program that runs all the time. Every now and then, a popup appears out of this program. To close this popup, it requires user to Check the Do-not-show-this-popup check box and then, click on OKAY button. Is there a python

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

2009-10-22 Thread Gabriel Genellina
En Thu, 22 Oct 2009 05:25:16 -0300, Lele Gaifax escribió: "Gabriel Genellina" writes: En Wed, 21 Oct 2009 06:24:55 -0300, Lele Gaifax escribió: "Gabriel Genellina" writes: nosetest should do nothing special. You should configure the environment so Python *knows* that your console under

Re: buggy popup

2009-10-22 Thread Gabriel Genellina
En Thu, 22 Oct 2009 07:14:31 -0300, Vinay Sagar Prakash escribió: On my windows machine, there is a Java based program that runs all the time. Every now and then, a popup appears out of this program. To close this popup, it requires user to Check the Do-not-show-this-popup check box and th

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

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: 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 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: [email protected] > CC: [email protected] > Subject: Re: Date strftime('%d%m%y') date to be of yesterday > > babou

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
$LIM $...@dy > Date: Thu, 22 Oct 2009 11:51:08 +0100 > From: [email protected] > CC: [email protected] > 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-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: 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

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

[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

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

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: Text file to XML representation

2009-10-22 Thread Jorgen Grahn
On Wed, 2009-10-21, [email protected] 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

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: 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: Passing values from html to python

2009-10-22 Thread Richard Brodie
"Albert Hopkins" wrote in message news:[email protected]... > 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: 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

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 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

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: 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 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: 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

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 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

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: 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 "!="

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: 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

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: 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

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: 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

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

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: 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

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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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 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 > [email protected]> wrote: >>> beSTEfar a écrit : >>> (snip) >>> > When parsing strings, use Regular Expressions. >>> >>> And now you h

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'

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: 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

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: 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

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: 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

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 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: 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 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: 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 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

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: 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, [email protected] wrote: > On Oct 22, 11:27 am, Steve wrote: > > > > > > > I have some data that I'm performing some ana

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: 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: 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

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

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

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

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: 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: 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: 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,

  1   2   >