Re: Logging question

2009-09-23 Thread Diez B. Roggisch
Gabor Urban schrieb: Hi guys, I have embarassing problem using the logging module. I would like to encapsulate the creation and setting up of the logger in a class, but it does not seem working. Here are my relevant parts of the code: -- import sys import logging class LogClass: def __in

Re: Very simple finite automaton (?)

2009-09-23 Thread Steven D'Aprano
On Tue, 22 Sep 2009 22:24:28 -0700, kpp9c wrote: > I am trying to use a table (called a transition table? i dunno) to > define a bunch of moves like so: > > 1 --> 2 5 > 2 --> 1 4 > 3 --> 3 > 4 --> 1 > 5 --> 4 3 > > so that i can generate a sequence that, given an initial value, will > continue t

Re: Very simple finite automaton (?)

2009-09-23 Thread Diez B. Roggisch
kpp9c schrieb: Very simple finite automaton (?) I am not sure if this is and example of Finite Automaton or a Finite State Machine or perhaps it is related to a transition table or markov process. I am not a math person so i am not sure what it is called. I googled around and got lots of super c

Looking for Python Developers in Jakarta, Indonesia

2009-09-23 Thread kugutsumen
Responsibilities: You will be part of a team responsible for implementing and supporting a Google App Engine based application. Requirements: Professional: University bachelor's degree in computer science or related discipline (web development, design, relevant computer languages and software ap

ARP Request/reply in Python

2009-09-23 Thread Nattapong Limprungpattanakit
Hello all. I want check Mac Address Client on network which alive help me please. Thanks. _ ด้วย Windows Live คุณสามารถจัดการ แก้ไข และแบ่งปันภาพถ่ายของคุณ http://www.microsoft.com/thailand/windows/windowslive/products/photo

Re: easy question, how to double a variable

2009-09-23 Thread Rhodri James
On Mon, 21 Sep 2009 21:49:50 +0100, daggerdvm wrote: you brain needs error checking! Your post, by contrast, needs grammar checking. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Read header and data from a binary file [LONG]

2009-09-23 Thread Jose Rafael Pacheco
Hello, I want to read from a binary file called myaudio.dat Then I've tried the next code: import struct name = "myaudio.dat" f = open(name,'rb') f.seek(0) chain = "< 4s 4s I 4s I 20s I I i 4s I 67s s 4s I" s = f.read(4*1+4*1+4*1+4*1+4*1+20*1+4*1+4*1+4*1+4*1+4*1+67*1+1+4*1+4*1) a = struct.unpack(

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-23 Thread Martin P. Hellwig
snfctech wrote: Does anyone have experience building a data warehouse in python? Any thoughts on custom vs using an out-of-the-box product like Talend or Informatica? I have an integrated system Dashboard project that I was going to build using cross-vendor joins on existing DBs, but I keep hea

Re: difficulty in understanding rsplit(None,1)[1]

2009-09-23 Thread John Machin
On Sep 22, 7:10 pm, hrishy wrote: > Hi Martin > > Many thanks > And by the way great way to explain that thing great way to find out for yourself faster than waiting for a response from the internet ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-23 Thread Steven D'Aprano
On Tue, 22 Sep 2009 07:41:11 -0700, Hyuga wrote: >> > Forget ethical.  We can do his homework for him, we can perhaps pass >> > exams for him, maybe graduate for him, and then with our luck, he'll >> > get a job in our office and we get to do his work for him. >> >> No, no, no.  The plan is to do

delete items from list by indices

2009-09-23 Thread blumenkraft
Hi, I have some list: x = [8, 9, 1, 7] and list of indices I want to delete from x: indices_to_delete = [0, 3], so after deletion x must be equal to [9, 1]. What is the fastest way to do this? Is there any builtin? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: delete items from list by indices

2009-09-23 Thread Chris Rebert
On Wed, Sep 23, 2009 at 1:25 AM, blumenkraft wrote: > Hi, > > I have some list: > x = [8, 9, 1, 7] > and list of indices I want to delete from x: > indices_to_delete = [0, 3], so after deletion x must be equal to [9, > 1]. > > What is the fastest way to do this? Is there any builtin? #untested &

Re: delete items from list by indices

2009-09-23 Thread Peter Otten
blumenkraft wrote: > I have some list: > x = [8, 9, 1, 7] > and list of indices I want to delete from x: > indices_to_delete = [0, 3], so after deletion x must be equal to [9, > 1]. > > What is the fastest way to do this? Is there any builtin? Why's that obsession with speed? >>> items = ["a",

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-23 Thread M.-A. Lemburg
snfctech wrote: > Does anyone have experience building a data warehouse in python? Any > thoughts on custom vs using an out-of-the-box product like Talend or > Informatica? > > I have an integrated system Dashboard project that I was going to > build using cross-vendor joins on existing DBs, but

Re: delete items from list by indices

2009-09-23 Thread Ishwor
Hi 2009/9/23 blumenkraft : > Hi, > > I have some list: > x = [8, 9, 1, 7] > and list of indices I want to delete from x: > indices_to_delete = [0, 3], so after deletion x must be equal to [9, > 1]. > > What is the fastest way to do this? Is there any builtin? Try this- >>> x = [8, 9, 1, 7] >>> [x

Re: delete items from list by indices

2009-09-23 Thread blumenkraft
On 23 сен, 12:48, Peter Otten <__pete...@web.de> wrote: > blumenkraft wrote: > > I have some list: > > x = [8, 9, 1, 7] > > and list of indices I want to delete from x: > > indices_to_delete = [0, 3], so after deletion x must be equal to [9, > > 1]. > > > What is the fastest way to do this? Is ther

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-23 Thread Martin P. Hellwig
snfctech wrote: Thanks for your replies, Sean and Martin. I agree that the ETL tools are complex in themselves, and I may as well spend that learning curve on a lower-level tool-set that has the added value of greater flexibility. Can you suggest a good book or tutorial to help me build a data

Re: Q on explicitly calling file.close

2009-09-23 Thread jhermann
>     except: >         return 0 So wrong on so many levels... -- http://mail.python.org/mailman/listinfo/python-list

TestFixtures 1.6.2 released!

2009-09-23 Thread Chris Withers
Hi All, I'm pleased to announce a new release of TestFixtures. This package is a collection of helpers and mock objects that are useful when writing unit tests or doc tests. This release fixes problems when using Comparison objects with instances of Django models, so tests like the following wi

Re: DBHandler class for logging?

2009-09-23 Thread Vinay Sajip
See my answer to a question on Stack Overflow, which has the source code for a simple handler which writes to a database using the Python DB-API 2.0: http://stackoverflow.com/questions/935930/creating-a-logging-handler-to-connect-to-oracle/1014450#1014450 Although the question relates to Oracle,

Re: Logging question

2009-09-23 Thread Vinay Sajip
On Sep 23, 6:36 am, Gabor Urban wrote: > Hi guys, > > I have embarassing problem using theloggingmodule. I would like to > encapsulate the creation and setting up  of the logger in a class, but > it does not seem working. > > Here are my relevant parts of the code: > > -- [snip] I'm not sure why

Re: easy question, how to double a variable

2009-09-23 Thread Casey Webster
On Sep 22, 9:57 am, Grant Edwards wrote: > > No, no, no.  The plan is to do his homework for him so that > he's incompetent when he graduates and won't be competition for > the rest of us who did do our homework. Don't forget the Peter principal --- we might end up working for him! Btw, I can't

Re: Very simple finite automaton (?)

2009-09-23 Thread MCIPERF
It seems to that you have a transformational grammar. Gerry On Sep 23, 3:18 am, "Diez B. Roggisch" wrote: > kpp9c schrieb: > > > > > Very simple finite automaton (?) > > > I am not sure if this is and example of Finite Automaton or a Finite > > State Machine or perhaps it is related to a transit

Re: Logging question

2009-09-23 Thread Jean-Michel Pichavant
Gabor Urban wrote: Hi guys, I have embarassing problem using the logging module. I would like to encapsulate the creation and setting up of the logger in a class, but it does not seem working. Here are my relevant parts of the code: -- import sys import logging class LogClass: def __init

Re: Logging question

2009-09-23 Thread Vinay Sajip
On Sep 23, 2:46 pm, Jean-Michel Pichavant wrote: > I personally use the following pattern: > > In any submodule moduleA.py of an application: > > import MyApp > _logger =logging.getLogger(MyApp.logger.name + '.moduleA') # attach my > logger to MyApp logger It's also common to use the pattern log

Re: Read header and data from a binary file [LONG]

2009-09-23 Thread Ishwor
Jose, Hi Note: I've worked with struct but a while ago so might be rusty a bit. Also, this sounds a bit like a homework. If it is a homework please do it yourself(or at least try) as you'd otherwise never know the knowledge behind it on real-world scenario :-) Having said that I am giving you bel

Re: easy question, how to double a variable

2009-09-23 Thread Brian Blais
On Sep 23, 2009, at 8:15 , Casey Webster wrote: Btw, I can't believe nobody provided the simplest literal solution: def twice(i): return i, i -- or this one, which is possibly even more literal: def twice(p): return "an int that is twice the value of the parameter" twice("an int par

Re: Read header and data from a binary file [LONG]

2009-09-23 Thread Ishwor
> char is 1 bytes long on Python (as per struct modules' definition) Also, this is also another option for you to use instead of built-in struct. http://www.sis.nl/python/xstruct/xstruct.shtml -- Regards, Ishwor Gurung -- http://mail.python.org/mailman/listinfo/python-list

Re: Twisted 100% event driven or hybrid?

2009-09-23 Thread exarkun
On 05:55 am, jacopo.pe...@gmail.com wrote: I am diving into Twisted and Perspective Broker (PB) in particular. I am designing a system having several models running on different machines, they need to be recalculated periodically, I have to collect the results, process them and start again from

Re: Solved - Python: automate input to MySQL query

2009-09-23 Thread D'Arcy J.M. Cain
On Tue, 22 Sep 2009 22:36:15 -0700 Dennis Lee Bieber wrote: > I wasn't really referring to the table used as a qualifier (in front > of the "."). But in your sample statement, every /field/ name seemed to > contain the table name too... > > traveler.travelerFirstName > > rather than

Re: Twisted: 1 thread in the reactor pattern

2009-09-23 Thread exarkun
On 06:08 am, jacopo.pe...@gmail.com wrote: I am diving into Twisted and Perspective Broker (PB) in particular and I would like to understand more about what happens behind the curtains. Say I have a client and a server on two different machines, the server gets callRemote() 19s in an asynchronous

Copy directory tree without copying files

2009-09-23 Thread Jeremy Conlin
I am trying to copy a folder hierarchy from one location to another. I can use the shutil.copytree function to copy the folder tree, but I don't want the files copied, just the folders. What is a good way to approach this? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy directory tree without copying files

2009-09-23 Thread Tim Golden
Jeremy Conlin wrote: I am trying to copy a folder hierarchy from one location to another. I can use the shutil.copytree function to copy the folder tree, but I don't want the files copied, just the folders. What is a good way to approach this? Thanks, Jeremy Use os.walk and create the directo

Re: Copy directory tree without copying files

2009-09-23 Thread dwatrous
Have you considered using os.walk? http://docs.python.org/library/os.html#os.walk It won't be completely automated, but I think it should allow you to easily walk the directory structure to reproduce it in another location. If the file names/extensions are predictable you might also be able to us

Re: Copy directory tree without copying files

2009-09-23 Thread Jeremy Conlin
On Sep 23, 9:15 am, Tim Golden wrote: > Jeremy Conlin wrote: > > I am trying to copy a folder hierarchy from one location to another. > > I can use the shutil.copytree function to copy the folder tree, but I > > don't want the files copied, just the folders.  What is a good way to > > approach thi

Re: Copy directory tree without copying files

2009-09-23 Thread Tim Golden
Jeremy Conlin wrote: On Sep 23, 9:15 am, Tim Golden wrote: Jeremy Conlin wrote: I am trying to copy a folder hierarchy from one location to another. I can use the shutil.copytree function to copy the folder tree, but I don't want the files copied, just the folders. What is a good way to appro

Re: Copy directory tree without copying files

2009-09-23 Thread Peter Otten
Jeremy Conlin wrote: > I am trying to copy a folder hierarchy from one location to another. > I can use the shutil.copytree function to copy the folder tree, but I > don't want the files copied, just the folders. What is a good way to > approach this? The easiest is def ignore(folder, names):

Re: Copy directory tree without copying files

2009-09-23 Thread Jeremy Conlin
On Sep 23, 9:15 am, dwatrous wrote: > Have you considered using > os.walk?http://docs.python.org/library/os.html#os.walk > > It won't be completely automated, but I think it should allow you to > easily walk the directory structure to reproduce it in another > location. > > If the file names/exte

cleanup in sys.excepthook?

2009-09-23 Thread akonsu
hello, my script creates files that i need to delete if an exception is thrown. is this a good pythonic style to do this kind of cleanup in sys.excepthook instead of inside except clause of a try block? konstantin -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy directory tree without copying files

2009-09-23 Thread Jeremy Conlin
On Sep 23, 9:31 am, Tim Golden wrote: > Jeremy Conlin wrote: > > On Sep 23, 9:15 am, Tim Golden wrote: > >> Jeremy Conlin wrote: > >>> I am trying to copy a folder hierarchy from one location to another. > >>> I can use the shutil.copytree function to copy the folder tree, but I > >>> don't want

Re: Copy directory tree without copying files

2009-09-23 Thread Grant Edwards
On 2009-09-23, Jeremy Conlin wrote: > I am trying to copy a folder hierarchy from one location to another. > I can use the shutil.copytree function to copy the folder tree, but I > don't want the files copied, just the folders. What is a good way to > approach this? Just in case there's no real

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-23 Thread nn
On Sep 22, 4:00 pm, snfctech wrote: > Does anyone have experience building a data warehouse in python?  Any > thoughts on custom vs using an out-of-the-box product like Talend or > Informatica? > > I have an integrated system Dashboard project that I was going to > build using cross-vendor joins o

Re: Very simple finite automaton (?)

2009-09-23 Thread akonsu
On Sep 23, 1:24 am, kpp9c wrote: > Very simple finite automaton (?) > > 1 --> 2 5 > 2 --> 1 4 > 3 --> 3 > 4 --> 1 > 5 --> 4 3 > hello, this is a graph and you are doing depth first search. konstantin -- http://mail.python.org/mailman/listinfo/python-list

Re: cleanup in sys.excepthook?

2009-09-23 Thread MRAB
akonsu wrote: hello, my script creates files that i need to delete if an exception is thrown. is this a good pythonic style to do this kind of cleanup in sys.excepthook instead of inside except clause of a try block? Speaking personally, I'd do the cleanup in the except clause if they needed

Re: Very simple finite automaton (?)

2009-09-23 Thread akonsu
On Sep 23, 11:49 am, akonsu wrote: > On Sep 23, 1:24 am, kpp9c wrote: > > > Very simple finite automaton (?) > > > 1 --> 2 5 > > 2 --> 1 4 > > 3 --> 3 > > 4 --> 1 > > 5 --> 4 3 > > hello, > this is a graph and you are doing depth first search. > konstantin BREADTH first. sorry :) -- http://mail

Re: cleanup in sys.excepthook?

2009-09-23 Thread Jean-Michel Pichavant
akonsu wrote: hello, my script creates files that i need to delete if an exception is thrown. is this a good pythonic style to do this kind of cleanup in sys.excepthook instead of inside except clause of a try block? konstantin def doIt(): pass try: doIt() except Exception, exc:

Re: Very simple finite automaton (?)

2009-09-23 Thread duncan smith
kpp9c wrote: > Very simple finite automaton (?) > > I am not sure if this is and example of Finite Automaton or a Finite > State Machine or perhaps it is related to a transition table or markov > process. I am not a math person so i am not sure what it is called. I > googled around and got lots of

Re: Most "active" coroutine library project?

2009-09-23 Thread Brian Hammond
On Aug 25, 12:51 am, Denis wrote: > You can also at gevent > > http://pypi.python.org/pypi/gevent Please, please document this! There are a lot of people who would love to use this but give up when they don't find a guide or something similar. -- http://mail.python.org/mailman/listinfo/python-l

Re: cleanup in sys.excepthook?

2009-09-23 Thread akonsu
On Sep 23, 11:57 am, Jean-Michel Pichavant wrote: > akonsu wrote: > > hello, > > > my script creates files that i need to delete if an exception is > > thrown. > > > is this a good pythonic style to do this kind of cleanup in > > sys.excepthook instead of inside except clause of a try block? > > >

Re: Copy directory tree without copying files

2009-09-23 Thread Jeremy Conlin
On Sep 23, 9:44 am, Grant Edwards wrote: > On 2009-09-23, Jeremy Conlin wrote: > > > I am trying to copy a folder hierarchy from one location to another. > > I can use the shutil.copytree function to copy the folder tree, but I > > don't want the files copied, just the folders.  What is a good wa

Unable to import package over NFS in solaris

2009-09-23 Thread Ashok
Hi, I have sqlalchemy package installed on the server. However I want to run a script on the client that uses the sqlalchemy package. Hence I shared the directory containing the sqlalchemy unsing NFS. Then I added the NFS pathname to the sqlalchemy packege in the client program. Now when I import

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-23 Thread snfctech
@Martin: I originally thought that there was nothing "magical" about building a data warehouse, but then I did a little research and received all sorts of feedback about how data warehouse projects have notorious failure rates, that data warehouse design IS different than normal RDBMS - and then t

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-23 Thread snfctech
@Lemburg: Thanks for the suggestion. I'm sure you make a fine product, but my development platform is Linux, and I don't want any additional Windows servers to deal with (than the ones I'm already stuck with.) On Sep 23, 2:02 am, "M.-A. Lemburg" wrote: > snfctech wrote: > > Does anyone have expe

Re: Dynamic Form

2009-09-23 Thread Victor Subervi
I've been trying the hidden field, but the problem is that when I set the variable flag, it stays in memory. I would rather just pass a var like I've been trying, but I don't think it's possible. Any ideas? Is a session cookie the only way? Here's more simplified code: #!/usr/bin/python import cg

Re: Unable to import package over NFS in solaris

2009-09-23 Thread Jeff McNeil
On Sep 23, 12:15 pm, Ashok wrote: > Hi, > > I have sqlalchemy package installed on the server. However I want to > run a script on the client that uses the sqlalchemy package. Hence I > shared the directory containing the sqlalchemy unsing NFS. Then I > added the NFS pathname to the sqlalchemy pac

Getting return code for a Python script invoked from a Linux shell script

2009-09-23 Thread volcano
Hi, folks, I have a Python script that is invoked by a shell script. I uses sys.exit() with a parameter within python. The calling script is using this line to get the return code: exit_code = !$ but it fails to get it. What's wrong here? (I am no Linux guru) Thanks in advance Mark -- http://ma

Re: Getting return code for a Python script invoked from a Linux shell script

2009-09-23 Thread Igor Pozgaj
On Wed, 23 Sep 2009 09:51:29 -0700, volcano wrote: > The calling script is using this line to get the return code: exit_code > = !$ > > but it fails to get it. What's wrong here? (I am no Linux guru) > Exit code is obtained with $?, not with !$ -- Igor Pozgaj | ipozgaj at gmail.com (GTalk / MS

Re: Most "active" coroutine library project?

2009-09-23 Thread Simon Forman
On Sun, Aug 23, 2009 at 11:02 AM, Phillip B Oldham wrote: > I've been taking a look at the multitude of coroutine libraries > available for Python, but from the looks of the projects they all seem > to be rather "quiet". I'd like to pick one up to use on a current > project but can't deduce which

Re: Getting return code for a Python script invoked from a Linux shell script

2009-09-23 Thread Donn
On Wednesday 23 September 2009 18:51:29 volcano wrote: > exit_code = !$ I think it's $? to get the code. \d -- home: http://otherwise.relics.co.za/ 2D vector animation : https://savannah.nongnu.org/projects/things/ Font manager : https://savannah.nongnu.org/projects/fontypython/ -- http://mail.py

Re: Getting return code for a Python script invoked from a Linux shell script

2009-09-23 Thread Jeff McNeil
On Sep 23, 12:51 pm, volcano wrote: > Hi, folks, > I have a Python script that is invoked by a shell script. I uses > sys.exit() with a parameter within python. > > The calling script is using this line to get the return code: > exit_code = !$ > > but it fails to get it. What's wrong here? (I am n

arrays in python

2009-09-23 Thread Rudolf
Can someone tell me how to allocate single and multidimensional arrays in python. I looked online and it says to do the following x = ['1','2','3','4'] However, I want a much larger array like a 100 elements, so I cant possibly do that. I want to allocate an array and then populate it using a for

tool per conversione e trasformazione dati

2009-09-23 Thread Francesco Stablum
Salve, lavoro in una ditta dove effettuiamo intensamente conversioni di database, trasformazione dei dati e raccolta da sorgenti diverse, successive query per fare dei "fix" eccetera... insomma, un lavoro bello complesso. Mi domandavo, insieme ai miei colleghi, se esistono dei tool/framework per e

Re: arrays in python

2009-09-23 Thread Donn
On Wednesday 23 September 2009 19:14:20 Rudolf wrote: > I want to allocate an array and then populate it > using a for loop. You don't need to allocate anything, just use the list or dictionary types. l=[] #empty list for x in range(1,500): l.append(x) \d -- http://mail.python.org/mailman/

Re: arrays in python

2009-09-23 Thread Benjamin Kaplan
On Sep 23, 2009, at 1:16 PM, Rudolf wrote: > Can someone tell me how to allocate single and multidimensional arrays > in python. I looked online and it says to do the following x = > ['1','2','3','4'] > > However, I want a much larger array like a 100 elements, so I cant > possibly do that. I wan

Re: tool per conversione e trasformazione dati

2009-09-23 Thread Francesco Stablum
I am sorry, the previous mail was intended to be published to the italian python mailing list, but... whoops, autocomplete tricked me... I will translate it in English: Hello, I work in a company where we do intensively database conversions, data transformations from different sources, queries of

Re: arrays in python

2009-09-23 Thread Michel Claveau - MVP
Hi! See: http://docs.python.org/tutorial (section 5) @+ -- MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: Twisted 100% event driven or hybrid?

2009-09-23 Thread Mike C. Fletcher
exar...@twistedmatrix.com wrote: > On 05:55 am, jacopo.pe...@gmail.com wrote: ... >> results to be ready, I collect and process them. From now on I don 19t >> need a the system to be event drive any more, the processing should >> occur only on the master machine, following a deterministic flow. >>

Get error message from FTPLib

2009-09-23 Thread Bakes
I am using ftplib for a project, using a try/except loop. I would like to find out the exception, but I am a python newbie and do not know how. How, in a try/except loop would I find the ftplib exception? -- http://mail.python.org/mailman/listinfo/python-list

Re: [SQL] Pick random rows from SELECT?

2009-09-23 Thread Gilles Ganault
On Mon, 21 Sep 2009 21:40:02 -0700, Dennis Lee Bieber wrote: > I'd suggest either a pool of threads -- 5-10, each reading company >names from a shared QUEUE, which is populated by the main thread >(remember to commit() so that you don't block on database updates by the >threads). OR... deter

Re: Most "active" coroutine library project?

2009-09-23 Thread exarkun
On 05:00 pm, sajmik...@gmail.com wrote: On Sun, Aug 23, 2009 at 11:02 AM, Phillip B Oldham wrote: I've been taking a look at the multitude of coroutine libraries available for Python, but from the looks of the projects they all seem to be rather "quiet". I'd like to pick one up to use on a curr

Re: Twisted 100% event driven or hybrid?

2009-09-23 Thread exarkun
On 05:48 pm, mcfle...@vrplumber.com wrote: exar...@twistedmatrix.com wrote: On 05:55 am, jacopo.pe...@gmail.com wrote: ... results to be ready, I collect and process them. From now on I don 19t need a the system to be event drive any more, the processing should occur only on the master machin

Re: Solved - Python: automate input to MySQL query

2009-09-23 Thread Joe Riopel
On Wed, Sep 23, 2009 at 10:49 AM, D'Arcy J.M. Cain wrote: > Of course you can get around this by specifying every field and using > "AS" to change the names to manager_id and employee_firstname, etc. but > if you are going to do that anyway, why not just do it once in the > database instead of lit

Searching Dictionary

2009-09-23 Thread Support Desk
i am trying to search a large Python dictionary for a matching value. The results would need to be structured into a new dictionary with the same structure. Thanks. The structure is like this { Key : [{'item':value,'item2':value,' item3':value,'item4':value,'item5':value','item6':value,'item7':va

Re: easy question, how to double a variable

2009-09-23 Thread David C Ullrich
On Tue, 22 Sep 2009 02:34:53 +, Steven D'Aprano wrote: > On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: > >> But you actually want to return twice the value. I don't see how to do >> that. > > What? > > Seriously? You're saying it _can_ be done in Python? They must have added

Idiom for "last word in a string"

2009-09-23 Thread Grant Edwards
I recently ran across this construct for grabbing the last (whitespace delimited) word in a string: s.rsplit(None,1)[1] It was somewhat obvious from the context what it was supposed to do, but it took a bit of Googling to figure out exactly what was going on. When I want the last word in a st

Re: Get error message from FTPLib

2009-09-23 Thread Jeff McNeil
On Sep 23, 1:46 pm, Bakes wrote: > I am using ftplib for a project, using a try/except loop. > > I would like to find out the exception, but I am a python newbie and > do not know how. > > How, in a try/except loop would I find the ftplib exception? For a bit on exception handling in general, ch

Re: Idiom for "last word in a string"

2009-09-23 Thread akonsu
On Sep 23, 2:47 pm, Grant Edwards wrote: > I recently ran across this construct for grabbing the last > (whitespace delimited) word in a string: > >    s.rsplit(None,1)[1] > > It was somewhat obvious from the context what it was supposed > to do, but it took a bit of Googling to figure out exactly

Open file on remote linux server

2009-09-23 Thread The Bear
Hi I'm looking to do something like this f = f.openfileobj(remotefileloc, localfilelikeobj) my remote files are on a solaris box that i can access using ssh (could prehap request othe protocols if necessary) anyone got any ideas? many thanks Charlie (ps. tried this on the python-forum but di

Querying for ownership of file shared by Samba fails with "MemoryError: allocating SECURITY_DESCRIPTOR"

2009-09-23 Thread Middle Fork GIS
I have just learned how to use the win32security module (within Windows, of course) to determine file ownership. When running against local drives or windows shares, this works fine, as shown in the following code (Python 2.4/2.5 with PyWin extensions): import win32security file = 'c:/temp/test.t

Re: Idiom for "last word in a string"

2009-09-23 Thread Christos Trochalakis
At Wed, 23 Sep 2009 18:47:05 + (UTC), Grant Edwards wrote: > > I recently ran across this construct for grabbing the last > (whitespace delimited) word in a string: > >s.rsplit(None,1)[1] > > It was somewhat obvious from the context what it was supposed > to do, but it took a bit of Goog

Re: Idiom for "last word in a string"

2009-09-23 Thread Christos Trochalakis
At Wed, 23 Sep 2009 18:47:05 + (UTC), Grant Edwards wrote: > > I recently ran across this construct for grabbing the last > (whitespace delimited) word in a string: > >s.rsplit(None,1)[1] > > It was somewhat obvious from the context what it was supposed > to do, but it took a bit of Goog

Re: Idiom for "last word in a string"

2009-09-23 Thread Christos Trochalakis
At Wed, 23 Sep 2009 18:47:05 + (UTC), Grant Edwards wrote: > > I recently ran across this construct for grabbing the last > (whitespace delimited) word in a string: > >s.rsplit(None,1)[1] > > It was somewhat obvious from the context what it was supposed > to do, but it took a bit of Goog

Re: Idiom for "last word in a string"

2009-09-23 Thread Christos Trochalakis
At Wed, 23 Sep 2009 18:47:05 + (UTC), Grant Edwards wrote: > > I recently ran across this construct for grabbing the last > (whitespace delimited) word in a string: > >s.rsplit(None,1)[1] > > It was somewhat obvious from the context what it was supposed > to do, but it took a bit of Googlin

Re: pygui - showing an image

2009-09-23 Thread kyle schalm
yes, that did the trick. i was not aware of all the examples in Test, only the three Demo projects. thanks! 2009/9/22 David Robinow : > There's an example in Tests/21-image.py > See if that helps. > -- http://mail.python.org/mailman/listinfo/python-list

pycopg2 build problems

2009-09-23 Thread devaru
Hi, I'm trying to install psycopg2 on my system. I followed the instruction in INSTALL file and gave the command python setup.py build running build running build_py running build_ext error: No such file or directory Where is the file or directory missing. Any help is appreciated. -- http://mail

Re: Idiom for "last word in a string"

2009-09-23 Thread Peter Otten
akonsu wrote: > On Sep 23, 2:47 pm, Grant Edwards wrote: >> I recently ran across this construct for grabbing the last >> (whitespace delimited) word in a string: >> >> s.rsplit(None,1)[1] >> >> It was somewhat obvious from the context what it was supposed >> to do, but it took a bit of Googling

Re: custom data warehouse in python vs. out-of-the-box ETL tool

2009-09-23 Thread Martin P. Hellwig
snfctech wrote: @Martin: I originally thought that there was nothing "magical" about building a data warehouse, but then I did a little research and received all sorts of feedback about how data warehouse projects have notorious failure rates, that data warehouse design IS different than normal

Re: pycopg2 build problems

2009-09-23 Thread Philip Semanchuk
On Sep 23, 2009, at 3:24 PM, devaru wrote: Hi, I'm trying to install psycopg2 on my system. I followed the instruction in INSTALL file and gave the command python setup.py build running build running build_py running build_ext error: No such file or directory Where is the file or directory mi

Re: Open file on remote linux server

2009-09-23 Thread Sean DiZazzo
On Sep 23, 12:04 pm, The Bear wrote: > Hi I'm looking to do something like this > > f = f.openfileobj(remotefileloc, localfilelikeobj) > > my remote files are on a solaris box that i can access using ssh (could > prehap request othe protocols if necessary) > > anyone got any ideas? > > many thanks

Re: Searching a large dictionary

2009-09-23 Thread mike171562
i am trying to search a large Python dictionary for a matching value. The results would need to be structured into a new dictionary with the same structure. Thanks. The structure is like this { Key : [{'item':value,'item2':value,' item3':value,'item4':value,'item5':value','item6':value,'item7':va

Re: arrays in python

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 1:14 PM, Rudolf wrote: > Can someone tell me how to allocate single and multidimensional arrays > in python. I looked online and it says to do the following x = > ['1','2','3','4'] > > However, I want a much larger array like a 100 elements, so I cant > possibly do that. I

Re: arrays in python

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 1:22 PM, Donn wrote: > On Wednesday 23 September 2009 19:14:20 Rudolf wrote: >> I want to allocate an array and then populate it >> using a for loop. > You don't need to allocate anything, just use the list or dictionary types. > > l=[] #empty list > for x in range(1,50

Re: arrays in python

2009-09-23 Thread Ethan Furman
Donn wrote: On Wednesday 23 September 2009 19:14:20 Rudolf wrote: I want to allocate an array and then populate it using a for loop. You don't need to allocate anything, just use the list or dictionary types. l=[] #empty list for x in range(1,500): l.append(x) \d Works great if you

Re: Most "active" coroutine library project?

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 2:05 PM, wrote: > On 05:00 pm, sajmik...@gmail.com wrote: >> >> On Sun, Aug 23, 2009 at 11:02 AM, Phillip B Oldham >> wrote: >>> >>> I've been taking a look at the multitude of coroutine libraries >>> available for Python, but from the looks of the projects they all seem

Re: Searching Dictionary

2009-09-23 Thread Dave Angel
Support Desk wrote: i am trying to search a large Python dictionary for a matching value. The results would need to be structured into a new dictionary with the same structure. Thanks. The structure is like this { Key : [{'item':value,'item2':value,' item3':value,'item4':value,'item5':value','i

Re: arrays in python

2009-09-23 Thread Donn
On Wednesday 23 September 2009 22:12:24 Ethan Furman wrote: > Works great if you want 4,999,999 elements. ;-) Omit the '1' if you > want all five million. Yes. Fenceposts always get me :) And I was just reminded that one can: l=range(500) \d -- home: http://otherwise.relics.co.za/ 2D vector

Re: Solved - Python: automate input to MySQL query

2009-09-23 Thread D'Arcy J.M. Cain
On Wed, 23 Sep 2009 11:37:07 -0700 Dennis Lee Bieber wrote: > On Wed, 23 Sep 2009 10:49:51 -0400, "D'Arcy J.M. Cain" > declaimed the following in gmane.comp.python.general: > > from pg import DB # PyGreSQL > > db = DB() # uses my default PostgeSQL database > > res = db.query(""" > > SELECT *

Re: recommendation for webapp testing?

2009-09-23 Thread lkcl
On Sep 17, 8:19 am, Simon Brunning wrote: > 2009/9/17 Schif Schaf : > > > What's the difference between WebDriver and Selenium? > > Selenium runs in a browser, and usesJavaScriptto perform all your > automated actions. It need a browser running to work. Several are > supported, Firefox, Safari, IE

Re: Searching Dictionary

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 2:31 PM, Support Desk wrote: > > i am trying to search a large Python dictionary for a matching value. The > results would need to be structured into a new dictionary with the same > structure. Thanks. > > The structure is like this > > { Key : [{'item':value,'item2':value,

Re: pycopg2 build problems

2009-09-23 Thread Wolodja Wentland
On Wed, Sep 23, 2009 at 12:24 -0700, devaru wrote: > I'm trying to install psycopg2 on my system. I followed the > instruction in INSTALL file and gave the command > python setup.py build > running build > running build_py > running build_ext > error: No such file or directory I ran into this some

  1   2   >