How to eliminate "Debug: src/helpers.cpp(140): 'CreateActCtx' failed" message ?

2010-05-11 Thread Barak, Ron
Hi, I created my first py2exe windows exe, and when it's run, I see on the console: $ ./svm_ts_tool_in_progress.exe 11:49:32: Debug: src/helpers.cpp(140): 'CreateActCtx' failed with error 0x007b (the filename, directory name, or volume label syntax is incorrect.). This is a non-fatal error

RE: How to get xml.etree.ElementTree not bomb on invalid characters in XML file ?

2010-05-04 Thread Barak, Ron
> -Original Message- > From: Stefan Behnel [mailto:stefan...@behnel.de] > Sent: Tuesday, May 04, 2010 10:24 AM > To: python-list@python.org > Subject: Re: How to get xml.etree.ElementTree not bomb on > invalid characters in XML file ? > > Barak, Ron, 04.05.2010

How to get xml.etree.ElementTree not bomb on invalid characters in XML file ?

2010-05-04 Thread Barak, Ron
Hi, I'm parsing XML files using ElementTree from xml.etree (see code below (and attached xml_parse_example.py)). However, I'm coming across input XML files (attached an example: tmp.xml) which include invalid characters, that produce the following traceback: $ python xml_parse_example.py Trace

RE: Need help with basic DOM XML tree traversing

2010-04-26 Thread Barak, Ron
> -Original Message- > From: Stefan Behnel [mailto:stefan...@behnel.de] > Sent: Sunday, April 25, 2010 6:42 PM > To: python-list@python.org > Subject: Re: Need help with basic DOM XML tree traversing > > Barak, Ron, 25.04.2010 17:06: > > This is my first

Need help with basic DOM XML tree traversing

2010-04-25 Thread Barak, Ron
Hi, This is my first try at XML with Python, and though I tried to read on the web, I'm unable to traverse a DOM tree, as my top element seems to be DOCUMENT_NODE and I cannot find a way to get to the nodes below it. Below is a sample data, script and execution. Could you point to where I'm do

Recall: How to add a library path to pythonpath ?

2010-03-18 Thread Barak, Ron
Barak, Ron would like to recall the message, "How to add a library path to pythonpath ?". -- http://mail.python.org/mailman/listinfo/python-list

RE: How to add a library path to pythonpath ?

2010-03-17 Thread Barak, Ron
> -Original Message- > From: Mark Hammond [mailto:skippy.hamm...@gmail.com] > Sent: Wednesday, March 17, 2010 2:08 AM > To: Barak, Ron > Cc: Pablo Recio Quijano; python-list@python.org > Subject: Re: How to add a library path to pythonpath ? > > On 17/03/2010 1

RE: How to add a library path to pythonpath ?

2010-03-17 Thread Barak, Ron
> -Original Message- > From: Dave Angel [mailto:da...@ieee.org] > Sent: Tuesday, March 16, 2010 6:24 PM > To: Barak, Ron > Cc: Pablo Recio Quijano; python-list@python.org > Subject: Re: How to add a library path to pythonpath ? > > Barak, Ron wrote: > &

RE: How to add a library path to pythonpath ?

2010-03-16 Thread Barak, Ron
> -Original Message- > From: Dave Angel [mailto:da...@ieee.org] > Sent: Tuesday, March 16, 2010 5:04 PM > To: Barak, Ron > Cc: Pablo Recio Quijano; python-list@python.org > Subject: RE: How to add a library path to pythonpath ? > > > > Barak, Ron wrote:

RE: How to add a library path to pythonpath ?

2010-03-16 Thread Barak, Ron
Quijano [mailto:rikuthero...@gmail.com] Sent: Tuesday, March 16, 2010 2:27 PM To: python-list@python.org Subject: Re: How to add a library path to pythonpath ? You have to add yout path to the list: import sys sys.path.append(your_path) Jus simple to add the element on the list :) 2010/3/16 Barak

How to add a library path to pythonpath ?

2010-03-16 Thread Barak, Ron
Hi, I'm trying to add a library path to my pythonpath, but seems it is not accepted - On Windows DOS window: C:\>echo %PYTHONPATH% c:\views\cc_view\TS_svm_ts_tool\SVMInspector\lib\ C:\>python -c "import sys ; print sys.path" ['', 'c:\\views\\cc_view\\TS_svm_ts_tool\\SVMInspector\\lib', 'C:\\WI

How to log messages _only once_ from all modules ?

2009-11-24 Thread Barak, Ron
Hi, I'm trying to add the logging module to my application, but I seem to be missing something. My application (a wxPython one) has a main script that calls various helper classes. I want the log messages from all modules to go to one central log file. When I implement logging, I think that due

How to log messages _only once_ from all modules ?

2009-11-24 Thread Barak, Ron
Hi, I'm trying to add the logging module to my application, but I seem to be missing something. My application (a wxPython one) has a main script that calls various helper classes. I want the log messages from all modules to go to one central log file. When I implement logging, I think that due

Recall: How to log messages _only once_ from all modules ?

2009-11-24 Thread Barak, Ron
Barak, Ron would like to recall the message, "How to log messages _only once_ from all modules ?". -- http://mail.python.org/mailman/listinfo/python-list

RE: Run pyc file without specifying python path ?

2009-08-02 Thread Barak, Ron
> -Original Message- > From: Dave Angel [mailto:da...@dejaviewphoto.com] > Sent: Thursday, July 30, 2009 20:08 > To: Barak, Ron > Cc: 'python-list@python.org' > Subject: Re: Run pyc file without specifying python path ? > > Barak, Ron wrote: > > Hi

RE: Run pyc file without specifying python path ?

2009-07-31 Thread Barak, Ron
> -Original Message- > From: Dave Angel [mailto:da...@dejaviewphoto.com] > Sent: Thursday, July 30, 2009 16:03 > To: Barak, Ron > Cc: 'Dave Angel'; 'python-list@python.org' > Subject: RE: Run pyc file without specifying python path ? > >

RE: Run pyc file without specifying python path ?

2009-07-30 Thread Barak, Ron
ious answer, I just cannot figure it out). Bye, Ron. > -Original Message- > From: Dave Angel [mailto:da...@dejaviewphoto.com] > Sent: Thursday, July 30, 2009 16:03 > To: Barak, Ron > Cc: 'Dave Angel'; 'python-list@python.org' > Subject: RE: Run pyc f

RE: Run pyc file without specifying python path ?

2009-07-30 Thread Barak, Ron
From: PythonAB [mailto:pyt...@rgbaz.eu] Sent: Thursday, July 30, 2009 12:18 To: Barak, Ron Cc: 'Dave Angel'; 'python-list@python.org' Subject: Re: Run pyc file without specifying python path ? Hi Dave, Your solution sort of defeats my int

RE: Run pyc file without specifying python path ?

2009-07-29 Thread Barak, Ron
> -Original Message- > From: Dave Angel [mailto:da...@ieee.org] > Sent: Wednesday, July 29, 2009 21:05 > To: Barak, Ron > Cc: 'python-list@python.org' > Subject: Re: Run pyc file without specifying python path ? > > Barak, Ron wrote: > > Hi, >

Run pyc file without specifying python path ?

2009-07-29 Thread Barak, Ron
Hi, I wanted to make a python byte-code file executable, expecting to be able to run it without specifying "python" on the (Linux bash) command line. So, I wrote the following: [r...@vmlinux1 python]# cat test_pyc.py #!/usr/bin/env python print "hello" [r...@vmlinux1 python]# and made its py

What are the limitations of cStringIO.StringIO() ?

2009-07-01 Thread Barak, Ron
Hi, I think I'm up against a limitation in cStringIO.StringIO(), but could not find any clues on the web, especially not in http://docs.python.org/library/stringio.html. What I have is the following function: def concatenate_files(self,filename_array): import types f = cSt

RE: A fast way to read last line of gzip archive ?

2009-05-26 Thread Barak, Ron
David Bolen [mailto:db3l@gmail.com] > Sent: Tuesday, May 26, 2009 03:56 > To: python-list@python.org > Subject: Re: A fast way to read last line of gzip archive ? > > "Barak, Ron" writes: > > > I couldn't really go with the shell utilities approach, as

How to pickle a 'PySwigObject' ?

2009-05-25 Thread Barak, Ron
Hi, I have a wxPython application that is creating a subprocess that performs a lengthy log analysis. Currently, the subprocess is displaying its results using its own MainLoop(). I want to display the subprocess' results using the parent process' MainLoop(). I tried to pickle the class instance

RE: A fast way to read last line of gzip archive ?

2009-05-24 Thread Barak, Ron
acceptable to (human) users. Bye, Ron. > -Original Message- > From: David Bolen [mailto:db3l@gmail.com] > Sent: Monday, May 25, 2009 01:58 > To: python-list@python.org > Subject: Re: A fast way to read last line of gzip archive ? > > "Barak, Ron" wr

RE: A fast way to read last line of gzip archive ?

2009-05-24 Thread Barak, Ron
> -Original Message- > From: garabik-news-2005...@kassiopeia.juls.savba.sk > [mailto:garabik-news-2005...@kassiopeia.juls.savba.sk] > Sent: Sunday, May 24, 2009 13:37 > To: python-list@python.org > Subject: Re: A fast way to read last line of gzip archive ? >

RE: wxpython and zoom/pan image

2009-05-24 Thread Barak, Ron
Hi Ross, You probably would get more focused answers if you addressed the question to the wxPython list at wxpython-us...@lists.wxwidgets.org As for your question, seeing your (simplified) code might help: out of hand, what you want to do is catch the events you're interested in (e.g., double-l

RE: A fast way to read last line of gzip archive ?

2009-05-23 Thread Barak, Ron
> -Original Message- > From: MRAB [mailto:goo...@mrabarnett.plus.com] > Sent: Thursday, May 21, 2009 19:02 > To: 'python-list@python.org' > Subject: Re: A fast way to read last line of gzip archive ? > > Barak, Ron wrote: > > Hi, > >

A fast way to read last line of gzip archive ?

2009-05-21 Thread Barak, Ron
Hi, I need to read the end of a 20 MB gzip archives (To extract the date from the last line of a a gzipped log file). The solution I have below takes noticeable time to reach the end of the gzip archive. Does anyone have a faster solution to read the last line of a gzip archive ? Thanks, Ron.

How to Spawn a process with P_NOWAIT and pass it some data ?

2009-05-20 Thread Barak, Ron
Hi, This is my first try at IPC in Python, and I would like to ask your help with the following problem: I would like to spawn a process with P_NOWAIT, and pass some data to the child process. I created two scripts to try IPC (in a blocking way): $ cat subprocess_sender.py #!/usr/bin/env pyth

RE: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-16 Thread Barak, Ron
Maybe try: p = Popen('./iodummy',stdin=PIPE, stdout=PIPE, stderr=PIPE).p (see "18.1.3.4. Replacing the os.spawn family" in http://docs.python.org/library/subprocess.html) Bye, Ron. > -Original Message- > From: Rüdiger Ranft [mailto:_r...@web.de] > Sent: Thursday, April 16, 2009 14:13

Solved: Metaclass conflict TypeError exception: problem demonstration script

2009-02-23 Thread Barak, Ron
Hi, > -Original Message- > From: Tim Golden [mailto:m...@timgolden.me.uk] > Sent: Monday, February 23, 2009 11:37 > Cc: python-list@python.org; wxpython-us...@lists.wxwidgets.org > Subject: Re: Metaclass conflict TypeError exception: problem > demonstration script > > > $ cat -n metaclass_

Metaclass conflict TypeError exception: problem demonstration script

2009-02-23 Thread Barak, Ron
Hi Guys, Thanks to Michele, Chris, Hrvoje et. al. who helped me trying to resolve the metaclass exception when a class has two parents problem. This post tries to unify all the metaclasses exception threads, in an attempt to reach a solution. I've created a short demo script (metaclass_test01.p

RE: Is there a way to ask a class what its metaclasses are ?

2009-02-23 Thread Barak, Ron
> -Original Message- > From: ch...@rebertia.com [mailto:ch...@rebertia.com] On > Behalf Of Chris Rebert > Sent: Sunday, February 22, 2009 22:12 > To: Barak, Ron > Cc: python-list@python.org > Subject: Re: Is there a way to ask a class what its metaclasses are ? >

RE: can error messages be improved or can they be overridden ?

2009-02-22 Thread Barak, Ron
Hi Stef, You can do something like (not tested): try: self.Brick.Par [ self.EP[2] ]['FileName'] = filename except IndexError,e: msg = "%s: '%s %s %s %d" % (e.strerror,e.filename,self.EP,self.EP[2],len(self.Brick.Par)) print msg Bye, Ron.

RE: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Barak, Ron
t; Subject: Re: "metaclass conflict" error: where is noconflict ? > > "Barak, Ron" writes: > > > class CopyAndPaste(): > > CopyAndPaste is an old-style class. Make it a new-style > class, and you'll probably be able to inherit from it and > wx.F

How to inherit from two classes without metaclass clashing ?

2009-02-22 Thread Barak, Ron
onato [mailto:michele.simion...@gmail.com] > Sent: Friday, February 20, 2009 07:23 > To: python-list@python.org > Subject: Re: "metaclass conflict" error: where is noconflict ? > > On Feb 19, 9:58 pm, Chris Rebert wrote: > > On Thu, Feb 19, 2009 at 5:01 AM, Barak, Ron &

Is there a way to ask a class what its metaclasses are ?

2009-02-22 Thread Barak, Ron
Hi Chris, > -Original Message- > From: ch...@rebertia.com [mailto:ch...@rebertia.com] On > Behalf Of Chris Rebert > Sent: Sunday, February 22, 2009 13:57 > To: Barak, Ron > Cc: python-list@python.org > Subject: Re: "metaclass conflict" error: where is noconf

RE: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Barak, Ron
Hi Chris, > -Original Message- > From: Chris Rebert [mailto:c...@rebertia.com] > Sent: Sunday, February 22, 2009 11:48 > To: Barak, Ron > Cc: python-list@python.org; wxpython-us...@lists.wxwidgets.org > Subject: Re: "metaclass conflict" error: where is noco

RE: "metaclass conflict" error: where is noconflict ?

2009-02-22 Thread Barak, Ron
Hi Chris, > -Original Message- > From: ch...@rebertia.com [mailto:ch...@rebertia.com] On > Behalf Of Chris Rebert > Sent: Thursday, February 19, 2009 22:58 > To: Barak, Ron > Cc: python-list@python.org; wxpython-us...@lists.wxwidgets.org > Subject: Re: "metaclass

"metaclass conflict" error: where is noconflict ?

2009-02-19 Thread Barak, Ron
Hi, I have a class derived from two parents (in blue below), which gives me the following error: $ python -u ./failover_pickle_demo09.py Traceback (most recent call last): File "./failover_pickle_demo09.py", line 291, in class ListControl(wx.Frame, CopyAndPaste): TypeError: Error when cal

Threads vs. processes, what to consider in choosing ?

2009-02-17 Thread Barak, Ron
Hi, May I have your recommendations in choosing threads or processes for the following ? I have a wxPython application that builds an internal database from a list of files and then displays various aspects of that data, in response to user's requests. I want to add a module that finds events

RE: Putting asterisks around text

2009-02-11 Thread Barak, Ron
[http://www.emofaces.com/en/emoticons/t/thumbs-up-emoticon.gif] -Original Message- From: D'Arcy J.M. Cain [mailto:da...@druid.net] Sent: Monday, February 09, 2009 20:21 To: todp...@hotmail.com Cc: python-list@python.org Subject: Re: Putting asterisks around text On Mon, 9 Feb 2009 10:09:2

RE: How to copy an instance without its cStringIO.StringO item ?

2009-02-09 Thread Barak, Ron
Machin [mailto:sjmac...@lexicon.net] Sent: Sunday, February 08, 2009 23:04 To: python-list@python.org Subject: Re: How to copy an instance without its cStringIO.StringO item ? On Feb 9, 1:01 am, Christian Heimes wrote: > Barak, Ron schrieb: > > > Hi, > > > I need to copy an insta

How to copy an instance without its cStringIO.StringO item ?

2009-02-08 Thread Barak, Ron
Hi John, Maybe you encountered the below issue in your Python programming, and you may offer advise ? I need to copy an instance of a class, where one of the items in the original is a cStringIO.StringO object. I do not need the cStringIO.StringO in the target object. The target instance is to

How to copy an instance without its cStringIO.StringO item ?

2009-02-08 Thread Barak, Ron
Hi, I need to copy an instance of a class, where one of the items in the original is a cStringIO.StringO object. I do not need the cStringIO.StringO in the target object. The target instance is to be pickled. Googling made me devise the following plan: do a deepcopy from the original to the tar

RE: How to find wxPython method documentation??

2009-02-05 Thread Barak, Ron
Hi Len, First off, there's the wxPython mailing list (To subscribe or unsubscribe via the World Wide Web, visit http://lists.wxwidgets.org/mailman/listinfo/wxpython-users or, via email, send a message with subject or body 'help' to wxpython-users-requ...@lists.wxwidgets.org) I also find Google

RE: How to execute a hyperlink?

2009-01-28 Thread Barak, Ron
Hi Muddy, http://docs.python.org/library/urllib2.html may help. Bye, Ron. -Original Message- From: Muddy Coder [mailto:cosmo_gene...@yahoo.com] Sent: Wednesday, January 28, 2009 03:00 To: python-list@python.org Subject: How to execute a hyperlink? Hi Folks, Module os provides a means o

RE: How to print lambda result ?

2009-01-20 Thread Barak, Ron
Ah, okay. Now it's clear. Thanks Tino. Ron. -Original Message- From: Tino Wildenhain [mailto:t...@wildenhain.de] Sent: Tuesday, January 20, 2009 14:45 To: Barak, Ron Cc: python-list@python.org Subject: Re: How to print lambda result ? Barak, Ron wrote: > Thanks Tino: your s

RE: How to print lambda result ?

2009-01-20 Thread Barak, Ron
[mailto:t...@wildenhain.de] Sent: Tuesday, January 20, 2009 14:22 To: Barak, Ron Cc: python-list@python.org Subject: Re: How to print lambda result ? Hi, Barak, Ron wrote: > Hi, > > Wanting to print the correct plural after numbers, I did the following: > > for num in range(1,4): > string_

How to print lambda result ?

2009-01-20 Thread Barak, Ron
Hi, Wanting to print the correct plural after numbers, I did the following: for num in range(1,4): string_ = "%d event%s" % (num,lambda num: num > 1 and "s" or "") print string_ However, instead of getting the expected output: 1 event 2 events 3 events I get: 1 event at 0x00AFE670> 2

RE: Could you suggest optimisations ?

2009-01-14 Thread Barak, Ron
Hi Terry, -Original Message- From: Terry Reedy [mailto:tjre...@udel.edu] Sent: Wednesday, January 14, 2009 01:57 To: python-list@python.org Subject: Re: Could you suggest optimisations ? Barak, Ron wrote: > Hi, > > In the attached script, the longest time is spent in the

Could you suggest optimisations ?

2009-01-13 Thread Barak, Ron
Hi, In the attached script, the longest time is spent in the following functions (verified by psyco log): def match_generator(self,regex): """ Generate the next line of self.input_file that matches regex. """ generator_ = self.line_generator()

RE: Relative performance of comparable regular expressions

2009-01-13 Thread Barak, Ron
on-list@python.org Subject: Re: Relative performance of comparable regular expressions On Jan 13, 7:24 pm, "Barak, Ron" wrote: > Hi, > > I have a question about relative performance of comparable regular > expressions. > > I have large log files that start with thr

Relative performance of comparable regular expressions

2009-01-13 Thread Barak, Ron
Hi, I have a question about relative performance of comparable regular expressions. I have large log files that start with three letters month names (non-unicode). Which would give better performance, matching with "^[a-zA-Z]{3}", or with "^\S{3}" ? Also, which is better (if different at all):

Is negative seek() from EOF of a GzipFile supported on Python 2.5.2 ?

2009-01-11 Thread Barak, Ron
lf.input_file.seek(-1, 2) # grab the last character TypeError: seek() takes exactly 2 arguments (3 given) -Original Message- From: Mark Tolonen [mailto:metolone+gm...@gmail.com] Sent: Thursday, January 08, 2009 17:16 To: python-list@python.org Subject: Re: Nubie question: how to not pass

RE: Nubie question: how to not pass "self" in call to seek() function ?

2009-01-08 Thread Barak, Ron
: Thursday, January 08, 2009 17:16 To: python-list@python.org Subject: Re: Nubie question: how to not pass "self" in call to seek() function ? "Barak, Ron" <> wrote in message news:7f0503cd69378f49be0dc30661c6ccf602494...@enbmail01.lsi.com... > Hi, > > I a

Nubie question: how to not pass "self" in call to seek() function ?

2009-01-08 Thread Barak, Ron
Hi, I am getting the error TypeError: seek() takes exactly 2 arguments (3 given), namely: $ ./_LogStream.py Traceback (most recent call last): File "./_LogStream.py", line 47, in log_stream.last_line_loc_and_contents() File "./_LogStream.py", line 20, in last_line_loc_and_contents s

RE: How to find the beginning of last line of a big text file ?

2009-01-04 Thread Barak, Ron
: How to find the beginning of last line of a big text file ? Sebastian Bassi wrote: > On Thu, Jan 1, 2009 at 2:19 PM, Barak, Ron wrote: >> I have a very big text file: I need to find the place where the last >> line begins (namely, the offset of the one-before-the-last '\n

How to find the beginning of last line of a big text file ?

2009-01-01 Thread Barak, Ron
Hi, I have a very big text file: I need to find the place where the last line begins (namely, the offset of the one-before-the-last '\n' + 1). Could you suggest a way to do that without getting all the file into memory (as I said, it's a big file), or heaving to readline() all lines (ditto) ?

Question withdrawn: seek() returns unexpected results

2008-12-25 Thread Barak, Ron
Hi, Problem solved when strip() is being replaced by strip('\n'). Happy holidays, Ron. ____ From: Barak, Ron Sent: Thursday, December 25, 2008 15:05 To: 'python-list@python.org' Subject: seek() returns unexpected results Hi, When using seek()

seek() returns unexpected results

2008-12-25 Thread Barak, Ron
Hi, When using seek() with a certain text file, I get strange results. I looked at the text file with a binary editor and verified with 'file', and it's an ASCII English text file. Running the script on other text files gives the expected output. Could you suggest the reason ? In the outputs

RE: os.system('cls')

2008-12-25 Thread Barak, Ron
Hi Dennis, print dir(os.system) print os.__dict__ might help Bye, Ron. From: Dennis van Oosterhout [mailto:de.slotenzwem...@gmail.com] Sent: Thursday, December 25, 2008 12:22 To: python-list@python.org Subject: os.system('cls') Hi there! I was searching

RE: How to change a generator ? - resolved

2008-12-24 Thread Barak, Ron
Hi Gabriel, Your remarks fixed my problem. Now my code looks as below, and behaves as expected. Thanks Gabriel. Merry Christmas and Happy Hanukkah, Ron. $ cat generator.py #!/usr/bin/env python import gzip from Debug import _line as line class LogStream(): def __init__(self, filename)

How to change a generator ?

2008-12-24 Thread Barak, Ron
Hi, I have a generator whose aim is to returns consecutive lines from a file (the listing below is a simplified version). However, as it is written now, the generator method changes the text file pointer to end of file after first invocation. Namely, the file pointer changes from 0 to 6623 on li

RE: Basic misunderstanding of generators - resolved

2008-12-22 Thread Barak, Ron
quot; log_stream = LogStream(filename) generator = log_stream.next_line(log_stream.input_file) #create generator line_ = generator.next() #get next item from generator print line_ -Original Message----- From: cvreb...@gmail.com [mailto:cvreb...@gmail.com] On Behalf Of Chris Rebert

Basic misunderstanding of generators

2008-12-22 Thread Barak, Ron
Hi All, I want to use generators to print lines taken from a gzipped file. I've never used generators, so probably my problem is basic misunderstanding of generators. In the below program, I expected the last line ("print line_") to print the first line of the sac.log.gz file. Instead, I get:

RE: Best Practice using Glade/Python (ericericaro: message 1 of 20)

2008-12-21 Thread Barak, Ron
Hi Eric, Once the UI is defined, you interface to events as usual, e.g.: def OnSelChanged(self, evt): self.tablecont = str(self.GetItemText(evt.GetItem())) self.dprint(line()+". OnSelChanged:", self.tablecont) self.TreeViewController(self.tablecont) self.Bind(wx.EVT_TR

RE: String slices work only for first string character ?

2008-12-16 Thread Barak, Ron
Thanks to all who pointed my wrong understanding of how string slices are defined. Bye, Ron. From: Barak, Ron [mailto:ron.ba...@lsi.com] Sent: Tuesday, December 16, 2008 15:35 To: python-list@python.org Subject: String slices work only for first string character

RE: String slices work only for first string character ?

2008-12-16 Thread Barak, Ron
Hi Mr. Cain, Mae culpa: obviously, I erroneously understood the number after the ':' as the string length. Thanks, Ron. -Original Message- From: D'Arcy J.M. Cain [mailto:da...@druid.net] Sent: Tuesday, December 16, 2008 15:45 To: Barak, Ron Cc: python-list@python.org Subj

String slices work only for first string character ?

2008-12-16 Thread Barak, Ron
Hi, Can any one explain why the following string slice works only for the first character, but not for any other ? $ cat /tmp/tmp.py #!/usr/bin/env python data = 'F0023209006-0101' print data print "|"+data[0:1]+"|" print "|"+data[1:1]+"|" print "|"+data[2:1]+"|" $ python `cygpath -w /tmp/tmp.

RE: tutorial on parser

2008-12-16 Thread Barak, Ron
Hi John, You may want to read http://nedbatchelder.com/text/python-parsers.html Bye, Ron. -Original Message- From: John Fabiani [mailto:jfabi...@yolo.com] Sent: Tuesday, December 16, 2008 08:47 To: python-list@python.org Subject: tutorial on parser Hi, I'm attempting to learn how to con

Pyhon (with wxPython) on Windows' cygwin: can it be done fully ?

2008-11-25 Thread Barak, Ron
Hi Pythonistas, I read diaz's comments with interest, but - in my current configuration, I'm unable to use pdb. I'm developing on cygwin and use wxPython. Consequently, I cannot use native cygwin Python, but my Python is actually the Windows XP Python (i.e., /cygdrive/c/Python25/python.exe). T

RE: Why is try...except in my code not working (gzip/text files) ?

2008-11-19 Thread Barak, Ron
in my code not working (gzip/text files) ? En Wed, 19 Nov 2008 13:25:03 -0200, Barak, Ron <[EMAIL PROTECTED]> escribió: > I need to read a file that is either a gzip or a text file (on both > *nix and Windows). > Since I didn't find a way to determine a file type, I thought of u

Two functionaly identical functions -> different results ??!

2008-11-19 Thread Barak, Ron
Hi Guys, I cannot see any difference between read1() and read2() below, and yet, one is okay, the other give an exception. In the first run, read2() is executed, and as expected, the text file is printed $ cat ./gzip_try.py import gzip FILE = "text_file.txt" def read2(): try: fl =

Why is try...except in my code not working (gzip/text files) ?

2008-11-19 Thread Barak, Ron
Hi, I need to read a file that is either a gzip or a text file (on both *nix and Windows). Since I didn't find a way to determine a file type, I thought of using the following: import gzip FILE = "../dpm/save_state-ssp8400-F0023209_080723-110131/top.1" #FILE = "../dpm/save_state-ssp8400-F00232

Log Manager application: are there components already built ?

2008-11-16 Thread Barak, Ron
Hi Guys, I need to create a Log Manager application that is able to accept log files with various line (e.g., error messages) formatting, and create log objects that could be put into a data-base. Some of the requirements of this Log Manager, from the perspective of a client program would be:

What are the Python tools to mine data from log files ?

2008-11-09 Thread Barak, Ron
Hi All, I need to create log files (data) mining tool. Are there any Python classes/modules/functions that are usually used in these cases, apart from "playing" with regular expressions ? The logs comprise of lines like so: Jul 31 09:53:13 iSW-00-091 kernel: T3=0x3a52b1e:3:0x8:fcs:FcsGetVpdLis

RE: Array of dict or lists or ....?

2008-10-07 Thread Barak, Ron
Would the following be suitable data structure: ... struct = {} struct["Nebraska"] = "Wabash" struct["Nebraska"]["Wabash"] = "Newville" struct["Nebraska"]["Wabash"]["Newville"]["topics"] = "Math" struct["Nebraska"]["Wabash"]["Newville"]["Math"]["Max Allowed Students"] = 20 struct["Nebraska"]["Wabas

The recent SPAM messages, and a suggested solution

2008-10-06 Thread Barak, Ron
Hi, I think most of us are annoyed by the recent SPAM messages that crept onto our list. I'd like to suggest a possible solution, and maybe start a thread that eventually will rid us of this unpleasantness. My idea: Once every few messages from the list owners, they would send a new numerical

How to copy a GUI2exe project - to serve as basis for new project ?

2008-09-24 Thread Barak, Ron
Hi, In GUI2exe, I'd like to create a project that is different from an existing project only in a few details (e.g., the location of the 'dist' directory). Is there a way to copy a current project - so it would serve as a basis for a new project ? Bye, Ron. -- http://mail.python.org/mailman/lis

ImportError: No module named zipextimporter on py2exe when { "compressed": 0 }

2008-09-10 Thread Barak, Ron
Hi, I'm trying to compile using py2exe, and am getting the following: $ python_win Setup.py py2exe running py2exe creating c:\Documents and Settings\rbarak\rbarak_devel\dpm09\build creating c:\Documents and Settings\rbarak\rbarak_devel\dpm09\build\bdist.win32 creating c:\Documents and Settings\r

"AttributeError: 'module' object has no attribute 'getdefaultlocale'" on Python start

2008-09-09 Thread Barak, Ron
Hi Fellow Pythonians, I stated getting the following when starting Python (2.5.2 on Windows XP): C:\Documents and Settings\RBARAK>python -v # installing zipimport hook import zipimport # builtin # installed zipimport hook # D:\Python25\lib\site.pyc matches D:\Python25\lib\site.py import site # pr