Re: number generator

2007-03-12 Thread Dick Moores
At 06:38 AM 3/10/2007, Steven D'Aprano wrote: >On Sat, 10 Mar 2007 02:32:21 -0800, Dick Moores wrote: > > > So why not just repeatedly call a function to generate lists of > > length N of random integers within the appropriate range (the closed > > interval [1,M-N-1]), and return the first list the

Re: Python in a desktop environment

2007-03-12 Thread krishnakant Mane
I have coded some complex programs in python in the recent past. I find it very robust and also not very slow (as is depicted by the starter of this thread ) I use wxpython on the gui side and testify that it is indeed very suitable for huge gui apps. may be pyqt is good enough too and I believe s

Re: number generator

2007-03-12 Thread Hendrik van Rooyen
"Nick Craig-Wood" <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > The fencepost method still seems to be simplest: > > > > t = sorted(random.sample(xrange(1,50), 4)) > > print [(j-i) for i,j in zip([0]+t, t+[50])] > > Mmm, nice. > > Here is another effort which is easier to reas

Eureka moments in Python

2007-03-12 Thread Steven D'Aprano
I'd be interested in hearing people's stories of Eureka moments in Python, moments where you suddenly realise that some task which seemed like it would be hard work was easy with Python. I had a recent one, where I had spent some time creating a function which took a list as an argument, and then

Re: Calling cpp from python/SWIG

2007-03-12 Thread Gabriel Genellina
En Tue, 13 Mar 2007 03:33:43 -0300, Frank <[EMAIL PROTECTED]> escribió: > I want to parse an array M1 from python to a cpp function fct which > returns an array M2. > > How can I do this best? Is SWIG appropriate or is there something > else? If you're going to call a single function, declare it

help developing an editor to view openoffice files.

2007-03-12 Thread krishnakant Mane
hello, right now I am involved on doing a very important accessibility work. as many people may or may not know that I am a visually handicap person and work a lot on accessibility. the main issue at hand is to create an accessible editor for open office. there are a lot of things remaining on tha

Re: Starting Python... some questions

2007-03-12 Thread Gabriel Genellina
En Tue, 13 Mar 2007 03:13:37 -0300, je . <[EMAIL PROTECTED]> escribió: > I added the self parameter to the the chassis_id function, however I now > have a problem and question regarding encoding MAC addresses for a > struct. What string format am I supposed to use? py> data = [int(x,16)

Re: Starting Python... some questions

2007-03-12 Thread Tim Roberts
You only need three things here: [EMAIL PROTECTED] wrote: > >#!/usr/bin/python >import scapy >import struct > >class lldp_class: > def __init__(self): > self.chassis_id_tlv = None > > def chassis_id(subtype, chassis_info): Make that def chassis_id(self, subtype,

Calling cpp from python/SWIG

2007-03-12 Thread Frank
Hi, I have the following problem: I want to parse an array M1 from python to a cpp function fct which returns an array M2. How can I do this best? Is SWIG appropriate or is there something else? If someone could give some code example or a link to a page with examples, that would be great! Tha

Re: Program __main__ function

2007-03-12 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> writes: > Now, when I write unit tests for my program (i.e. a Python module > designed to be run as a command), it can still be imported safely > into my unit tests, and all the code gets covered by test cases > except the three-line stanza at the end. All I need no

Re: Starting Python... some questions

2007-03-12 Thread jezzzz .
Jordan, Thinker, Steven, Thanks for your responses. Makes more sense now! I can run my program from the console. I added the self parameter to the the chassis_id function, however I now have a problem and question regarding encoding MAC addresses for a struct. What string format am I sup

Program __main__ function (was: Starting Python... some questions)

2007-03-12 Thread Ben Finney
[EMAIL PROTECTED], "Greenberg <"@bag.python.org, "greenbergj\""@NOSPAM.xs4all.nl, [EMAIL PROTECTED], ">"@bag.python.org writes: > [EMAIL PROTECTED] wrote: > > * Doesn't the __main__() method automatically execute when I run > > my python program? > > No, there is no special __main__ function, to

Re: distributed queue?

2007-03-12 Thread Paul Rubin
Bjoern Schliessmann <[EMAIL PROTECTED]> writes: > Twisted _is_ asynchronous networking. It also has database classes: > http://twistedmatrix.com/documents/current/api/twisted.enterprise.html I see it uses threads: http://twistedmatrix.com/trac/browser/trunk/twisted/enterprise/adbapi.py#L326 -- h

Re: converting epoch time to string (and vice versa)

2007-03-12 Thread Amit Khemka
On 3/13/07, Astan Chee <[EMAIL PROTECTED]> wrote: > Hi, > I have a string in this format "DD/MM/YYY" for example: > tdate = "18/01/1990" > and Im trying to convert this to epoch time, can anyone help? import calendar t = map(int,tdate.split('/')) epochs = calendar.timegm((t[2], t[1], t[0], 0, 0, 0

converting epoch time to string (and vice versa)

2007-03-12 Thread Astan Chee
Hi, I have a string in this format "DD/MM/YYY" for example: tdate = "18/01/1990" and Im trying to convert this to epoch time, can anyone help? Im also trying to convert that epoch time to the string format previously. Can anyone help this one too? Thanks! Astan -- http://mail.python.org/mailman/l

Re: threading and iterator crashing interpreter

2007-03-12 Thread Rhamphoryncus
On Mar 12, 4:47 pm, "Klaas" <[EMAIL PROTECTED]> wrote: > On Mar 12, 1:10 pm, "Rhamphoryncus" <[EMAIL PROTECTED]> wrote: > > >http://sourceforge.net/tracker/index.php?func=detail&aid=1579370&grou... > > > That refers to a generator crash. You are using generators, but also > > getting a weird dict

Re: Starting Python... some questions

2007-03-12 Thread Steven D'Aprano
On Mon, 12 Mar 2007 21:39:11 -0700, jezonthenet wrote: > I started using Python a couple of days ago - here are a few > questions: > > * Doesn't the __main__() method automatically execute when I run my > python program? No. > * Only when I do an import of my test.py file within python and t

Re: Starting an external, independent process from a script

2007-03-12 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Henrik Lied wrote: > Hi there! > > > So - I want to spawn a new system process. I need some good > pointers on how to do this right. > > Any input? :-) > > Thanks a lot in advance! > You can try os.spawnl(). The url is http://docs.python.org/lib/os-pro

Re: Starting Python... some questions

2007-03-12 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: > I started using Python a couple of days ago - here are a few > questions: > > * Doesn't the __main__() method automatically execute when I run my > python program? > * Only when I do an import of my test.py file within python

Re: Starting Python... some questions

2007-03-12 Thread Greenberg
[EMAIL PROTECTED] wrote: > I started using Python a couple of days ago - here are a few > questions: > > * Doesn't the __main__() method automatically execute when I run my > python program? > * Only when I do an import of my test.py file within python and then > run test.__main__() I can see wher

Calling cpp from python/SWIG

2007-03-12 Thread Frank
Hi, I have the following problem: I want to call a cpp program from python. Let's call this cpp program fct. The problem is that I will parse a large array, say M1, to fct and also receive a large array, say M2 back (each about 1000 x 1000). Normally, I would write M1 to a file, call fct via sub

Starting Python... some questions

2007-03-12 Thread jezonthenet
I started using Python a couple of days ago - here are a few questions: * Doesn't the __main__() method automatically execute when I run my python program? * Only when I do an import of my test.py file within python and then run test.__main__() I can see where my bugs are. Is this correct? (right

Re: how to set different TCP_KEEPALIVE parameters for different socket ?

2007-03-12 Thread Marco
Oh, I see, sd.getsockopt(SOL_TCP, TCP_*) On 3/13/07, Marco <[EMAIL PROTECTED]> wrote: > Hi, > > I can use sd.setsockopt() to enable the socket use TCP keepalive > feature, but how to set a different parameters(interval, probes and > time) for it? > Sure, I can modify /proc/sys/net/ipv4/tcp_* , bu

how to set different TCP_KEEPALIVE parameters for different socket ?

2007-03-12 Thread Marco
Hi, I can use sd.setsockopt() to enable the socket use TCP keepalive feature, but how to set a different parameters(interval, probes and time) for it? Sure, I can modify /proc/sys/net/ipv4/tcp_* , but need root password and will affect other program. Thank you! -- LinuX Power -- http://mail.p

Error 14 on OS Call

2007-03-12 Thread Jeremy
Hi, I recently started using Python and am working on Python 2.3.6 on Redhat. I have developed a fat C++ extension for it and have the following problem: The main module is in the Python code which gets a packet pk of string type from the extension. It then passes pk to an IP tunnel using os.writ

Re: httplib/socket problems reading 404 Not Found response

2007-03-12 Thread Gabriel Genellina
En Tue, 13 Mar 2007 00:07:55 -0300, Patrick Altman <[EMAIL PROTECTED]> escribió: > I am attempting to use a HEAD request against Amazon S3 to check > whether a file exists or not and if it does parse the md5 hash from > the ETag in the response to verify the contents of the file so as to > save

Re: using python to visit web sites and print the web sites image to files

2007-03-12 Thread imx
On 3月13日, 上午12时39分, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Mar 12, 7:32 am, "imx" <[EMAIL PROTECTED]> wrote: > > > I wonder whether python can be used to simulate a real user to do the > > following: > > 1) open a web site in a browser; > > 2) printscreen, so to copy the current active

Re: Python in a desktop environment

2007-03-12 Thread Grant Edwards
On 2007-03-13, David Cramer <[EMAIL PROTECTED]> wrote: > Everyone seems to have misunderstood what I want. One might suspect that your request was unclear. ;) > I'm a Python developer, I don't give a rats ass about what > people say about C#, Python, or c++, they all have their uses. > My main r

httplib/socket problems reading 404 Not Found response

2007-03-12 Thread Patrick Altman
I am attempting to use a HEAD request against Amazon S3 to check whether a file exists or not and if it does parse the md5 hash from the ETag in the response to verify the contents of the file so as to save on bandwidth of uploading files when it is not necessary. If the file exist, the HEAD works

Re: Interface in IronPython

2007-03-12 Thread Steve Holden
Bruno Desthuilliers wrote: > edfialk a écrit : >> Hi all, I'm pretty much totally new to IronPython and have come to the >> point that I need an interface to interact with a co-worker's code, >> but I can't seem to find any documents or discussion on syntax for >> writing an interface. >> >> Does a

Re: a better solution for GUI in python

2007-03-12 Thread Chris Mellon
On 3/12/07, David Boddie <[EMAIL PROTECTED]> wrote: > On Monday 12 March 2007 16:57, Chris Mellon wrote: > > > Gtk I consider an extremely poor contender as a cross platform > > toolkit. The runtime is enormous and it makes little effort to appear > > native on any non-GNOME platform. > > Given tha

Re: Single string print statements on multiple lines.

2007-03-12 Thread Steven D'Aprano
On Mon, 12 Mar 2007 05:40:44 -0700, MonkeeSage wrote: > HeEm wrote: >> In my 100 level CS course, I was asked to create multiple lines of >> output within a single string. Of course I know how to: > > If this is for a CS course, you shouldn't really be cheating and > asking for an answer here, s

Re: Readline()

2007-03-12 Thread Sick Monkey
Maybe if you show us your code we can better assist you. But maybe you can use a global variable or a try-catch method to keep threads from staying alive and help better control your code. On 3/12/07, Taylor, Stuart <[EMAIL PROTECTED]> wrote: I have been working on running an external process

Re: a better solution for GUI in python

2007-03-12 Thread David Boddie
On Monday 12 March 2007 16:57, Chris Mellon wrote: > Gtk I consider an extremely poor contender as a cross platform > toolkit. The runtime is enormous and it makes little effort to appear > native on any non-GNOME platform. Given that wxPython more or less relies on GTK+ on Linux, I think you're

Re: How do I Color a QTableView row in PyQt4

2007-03-12 Thread David Boddie
On Friday 02 March 2007 21:55, Mel wrote: [This message is a bit old now. Still...] > Now that I can change the row colors of QTableView when loading data I > now need to be able to set the color of the row at anytime. I've been > trying by using an item delegate but I'm not sure if I'm using

Re: attaching Tkinter Listbox to python list object

2007-03-12 Thread jim-on-linux
On Monday 12 March 2007 20:34, Steve Potter wrote: > I am trying to find some method of attaching a > Listbox object to a list object so as the > contents of the list are changed the contents > of the Listbox will be updated to match. I > have found a few references to something like > this in thi

Re: attaching Tkinter Listbox to python list object

2007-03-12 Thread James Stroud
Steve Potter wrote: > I am trying to find some method of attaching a Listbox object to a > list object so as the contents of the list are changed the contents of > the Listbox will be updated to match. I have found a few references > to something like this in this old post > http://groups.google.c

Re: Request for a change in the csv module.

2007-03-12 Thread Paulo da Silva
[EMAIL PROTECTED] escreveu: > On Mar 12, 4:26 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: ... > > locale.setlocale(locale.LC_NUMERIC, 'pt_BR.ISO8859-1') > csv_writer = csv.writer(open("foo.csv","w"), dialect='excel') > rows = (('testing', 1.23), ('testing', 2.34)) > formatted_rows = ((string, l

Re: Python in a desktop environment

2007-03-12 Thread David Cramer
On Mar 12, 9:56 am, Bruno Desthuilliers wrote: > Diez B. Roggisch a écrit : > > > Bruno Desthuilliers wrote: > > >> Grant Edwards a écrit : > >> (snip) > > >>> Python is _far_ more robust than C++. > > >> I wouldn't say so - robustness is a quality of a program, not of a > >> language !-) > > > No

Re: using python to visit web sites and print the web sites image to files

2007-03-12 Thread imx
On 3月13日, 上午4时26分, "Paul Boddie" <[EMAIL PROTECTED]> wrote: > Goldfish wrote: > > You can definitely create a web bot with python. It doesn't require > > that you "drive" A real web browser. > > That's true, but if you want to print the page to a file, you need > something that can reproduce the in

attaching Tkinter Listbox to python list object

2007-03-12 Thread Steve Potter
I am trying to find some method of attaching a Listbox object to a list object so as the contents of the list are changed the contents of the Listbox will be updated to match. I have found a few references to something like this in this old post http://groups.google.com/group/comp.lang.python/brow

Re: File locking

2007-03-12 Thread John Nagle
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Dr. Who wrote: > > >>Please let me know if I'm missing something since they seem like >>normal file operations that I would hope Python would abstract away. > > > I don't think of them as "normal" operations. They are "extra" stuff that

Re: Request for a change in the csv module.

2007-03-12 Thread attn . steven . kuo
On Mar 12, 4:26 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: > Hi. > > I have just seen that csv module, more exactly the Dialect class, > does not have any variable to specify the "floating point" character! > In portuguese this is ','. Not '.'. 3.1415 -> 3,1415. > I think this is also the case o

Request for a change in the csv module.

2007-03-12 Thread Paulo da Silva
Hi. I have just seen that csv module, more exactly the Dialect class, does not have any variable to specify the "floating point" character! In portuguese this is ','. Not '.'. 3.1415 -> 3,1415. I think this is also the case of other languages/countries. If I am correct, i.e. if there is no such po

Starting an external, independent process from a script

2007-03-12 Thread Henrik Lied
Hi there! I'm trying to create a video uploading service (just to learn). The system is mostly based on Django, but the question I'm looking an answer for is more related to Python. So, the user gets to upload a video file. This can either be a mpg, avi or mp4-file. When the file is saved to its

Re: threading and iterator crashing interpreter

2007-03-12 Thread Klaas
On Mar 12, 1:10 pm, "Rhamphoryncus" <[EMAIL PROTECTED]> wrote: > http://sourceforge.net/tracker/index.php?func=detail&aid=1579370&grou... > > That refers to a generator crash. You are using generators, but also > getting a weird dict error. Maybe related, maybe not. > > I'll figure out if I've go

Re: Signed zeros: is this a bug?

2007-03-12 Thread Ben Finney
[EMAIL PROTECTED] (Alex Martelli) writes: > This is not trivial to fix cleanly...:-(. compiler_add_o would have > to test "is the object I'm storing -0.0" (I don't even know how to > do that in portable C...) and then do some kludge -- e.g. use as the > key into the dict (-0.0, 0) instead of (-0.

Re: Python for amd64 and x86 on Windows

2007-03-12 Thread Trent Mick
Hengel, Simon wrote: > Hello List, > I need the amd64 and the x86 version of Python installed on one Windows > machine. Is there a way to do this? (I think I read about it somewhere, but > now I can't find it anymore) Bit of a hack but you could install the MSI ActivePython package for one and

Re: backslashes in lists

2007-03-12 Thread Gabriel Genellina
En Mon, 12 Mar 2007 12:30:59 -0300, Fabio Gomes <[EMAIL PROTECTED]> escribió: > Nice, Lucas. But help me again, please. What about "echoing" the > list:>>> str(alist).replace('','\\')"['a', 'b', 'c:\\some\\path']" The \ character is used as an escape character, to represent some non-pr

Re: Interface in IronPython

2007-03-12 Thread Bruno Desthuilliers
edfialk a écrit : > Hi all, I'm pretty much totally new to IronPython and have come to the > point that I need an interface to interact with a co-worker's code, > but I can't seem to find any documents or discussion on syntax for > writing an interface. > > Does anyone know of a link that talks ab

Re: New to Python

2007-03-12 Thread Nanjundi
On Mar 12, 4:49 am, "Bert Heymans" <[EMAIL PROTECTED]> wrote: > On Mar 12, 3:02 am, Alberto Vieira Ferreira Monteiro > > <[EMAIL PROTECTED]> wrote: > > Hi, I am new to Python, how stupid can be the questions I ask? > > > For example, how can I add (mathematically) two tuples? > > x = (1,2) > > y =

Interface in IronPython

2007-03-12 Thread edfialk
Hi all, I'm pretty much totally new to IronPython and have come to the point that I need an interface to interact with a co-worker's code, but I can't seem to find any documents or discussion on syntax for writing an interface. Does anyone know of a link that talks about interfaces in IronPython o

Re: New to Python

2007-03-12 Thread Gabriel Genellina
En Mon, 12 Mar 2007 10:25:15 -0300, Alberto Monteiro <[EMAIL PROTECTED]> escribió: > For example, yesterday I wanted to open a window, draw some > image, and make it move. I tried it with tkinter and with pygame, > but I didn't succeed - there was no way I could find how to > begin the image in

Re: using python to visit web sites and print the web sites image to files

2007-03-12 Thread Paul Boddie
Goldfish wrote: > You can definitely create a web bot with python. It doesn't require > that you "drive" A real web browser. That's true, but if you want to print the page to a file, you need something that can reproduce the intended layout. The Pyglet library developers mention "XML/HTML+CSS" as

Re: Newbie Question : "grep"

2007-03-12 Thread Larry Bates
[EMAIL PROTECTED] wrote: > On 12 Mar, 18:55, [EMAIL PROTECTED] wrote: >> On Mar 12, 10:01 am, "Erik Johnson" <[EMAIL PROTECTED]> wrote: >> >> >> >>> Sorry, I forgot to paste the modified version of my code in the post:. I >>> think this is the same behaviour: >>> for line in lines: >>> if "plac

Re: threading and iterator crashing interpreter

2007-03-12 Thread Rhamphoryncus
On Mar 11, 8:35 am, "Janto Dreijer" <[EMAIL PROTECTED]> wrote: > On Mar 11, 3:27 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > At least, the problem of using the same generator from different threads > > still remains, if you don't use my modified code. In general, when using > > multipl

Find the path of a running .py program

2007-03-12 Thread Laszlo Nagy
Hi All! There was a thread here, more than a month ago. It was about finding the path of a .py file. I suggested os.abspath(__file__). Others told that sys.argv[0] is better. I was not sure why I did not like that solution. Now I ran into the problem again, and I now I remember what is the

Re: glob.glob output

2007-03-12 Thread Bruno Desthuilliers
Hitesh a écrit : > import string > import os > > f = open ("c:\\servername.txt", 'r') > linelist = f.read() > > lineLog = string.split(linelist, '\n') > lineLog = lineLog [:-1] > #print lineLog > for l in lineLog: > path1 = "" + l + "\\server*\\*\\xtRec*" > glob.glob(path1) And ? Wha

Re: using python to visit web sites and print the web sites image to files

2007-03-12 Thread Alberto Monteiro
Goldfish wrote: > > I run a mediawiki web site, and found a handy python-based library > written to manage it called pywikipediabot at http://sourceforge.net/projects/pywikipediabot/. > This sounds interesting. My daughter had a nightmare that a hacker invaded her Orkut and blanked all 1500+ scr

Re: How to test if a key in a dictionary exists?

2007-03-12 Thread [EMAIL PROTECTED]
On Mar 11, 11:49 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > On Mar 12, 3:19 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > > Paul McGuire <[EMAIL PROTECTED]> wrote: > > > will be. For instance, when working with data from 0 to 100 and > > > looking for frequencies by decade, you can initiali

Re: using python to visit web sites and print the web sites image to files

2007-03-12 Thread Goldfish
You can definitely create a web bot with python. It doesn't require that you "drive" A real web browser. There are libraries to open web pages, scrape their contents, and do downloading. That would make your bot platform neutral. Driving a GUI browser has the risk of being a brittle script that mig

Re: Watching a file another app is writing

2007-03-12 Thread Gordon Airporte
Vishal Bhargava wrote: > What kind of file is it? CSV? It's a hand history file generated by an online poker client, thus it probably keeps it's data pretty much to itself otherwise, and in any case I'm not a Windows programmer so I probably don't have the stomach to get very deep into its proc

Re: New to Python

2007-03-12 Thread Goldfish
I read http://diveintopython.org/ online, and covered a lot of Python territory nicely with this. Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Single string print statements on multiple lines.

2007-03-12 Thread Goldfish
http://www.catb.org/~esr/faqs/smart-questions.html Don't post homework questions. -- http://mail.python.org/mailman/listinfo/python-list

Re: Watching a file another app is writing

2007-03-12 Thread Gordon Airporte
Gabriel Genellina wrote: > This article explains it in detail: > http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html > > > BTW, it's the top result on Google for "python notify file change windows" > > --Gabriel Genellina Ah, excelent. Thank you. I'd started w

Re: Watching a file another app is writing

2007-03-12 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: >> On Unix a quick shortcut would be to simply read the output of 'tail - >> f ' command... > > "tail -f" just checks the file size once a second. It's not doing > anything exciting. That's not actually always true these days. *BSD, at least,

Re: File locking

2007-03-12 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Dr. Who wrote: > Please let me know if I'm missing something since they seem like > normal file operations that I would hope Python would abstract away. I don't think of them as "normal" operations. They are "extra" stuff that is not only dependent on the operating system

Re: glob.glob output

2007-03-12 Thread Hitesh
On Mar 12, 2:12 pm, "Hitesh" <[EMAIL PROTECTED]> wrote: > On Mar 12, 1:58 pm, "Hitesh" <[EMAIL PROTECTED]> wrote: > > > > > > > import string > > import os > > > f = open ("c:\\servername.txt", 'r') > > linelist = f.read() > > > lineLog = string.split(linelist, '\n') > > lineLog = lineLog [:-1] > >

Re: Newbie Question : "grep"

2007-03-12 Thread moogyd
On 12 Mar, 18:55, [EMAIL PROTECTED] wrote: > On Mar 12, 10:01 am, "Erik Johnson" <[EMAIL PROTECTED]> wrote: > > > > > Sorry, I forgot to paste the modified version of my code in the post:. I > > think this is the same behaviour: > > > for line in lines: > > if "placed" in line: > > if "

RE: Watching a file another app is writing

2007-03-12 Thread Vishal Bhargava
What kind of file is it? CSV? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Sanders Sent: Monday, March 12, 2007 11:26 AM To: python-list@python.org Subject: Re: Watching a file another app is writing Gordon Airporte wrote: > I'm trying to find

Re: Watching a file another app is writing

2007-03-12 Thread Jeremy Sanders
Gordon Airporte wrote: > I'm trying to find a way to take a file that another program has opened > and writes to periodically, open it simultaneously in Python, and > automatically update some of my objects in Python when the file is > written to. > I can open the file and manually readlines() fro

Re: glob.glob output

2007-03-12 Thread Hitesh
On Mar 12, 1:58 pm, "Hitesh" <[EMAIL PROTECTED]> wrote: > import string > import os > > f = open ("c:\\servername.txt", 'r') > linelist = f.read() > > lineLog = string.split(linelist, '\n') > lineLog = lineLog [:-1] > #print lineLog > for l in lineLog: > path1 = "" + l + "\\server*\\*\\xtRe

File locking

2007-03-12 Thread Dr. Who
I'm always disappointed when I find something that Python doesn't handle in a platform independent way. It seems to me that file locking is in that boat. 1. I don't see a way to atomically open a file for writing if and only if it doesn't exist without resorting to os.open and specialized platfor

glob.glob output

2007-03-12 Thread Hitesh
import string import os f = open ("c:\\servername.txt", 'r') linelist = f.read() lineLog = string.split(linelist, '\n') lineLog = lineLog [:-1] #print lineLog for l in lineLog: path1 = "" + l + "\\server*\\*\\xtRec*" glob.glob(path1) When I run above from command line python, It prin

Re: Newbie Question : "grep"

2007-03-12 Thread attn . steven . kuo
On Mar 12, 10:01 am, "Erik Johnson" <[EMAIL PROTECTED]> wrote: > Sorry, I forgot to paste the modified version of my code in the post:. I > think this is the same behaviour: > > for line in lines: > if "placed" in line: > if "i_a/i_b/ROM/" in line: > pos = (line.split()[4]).

Re: Watching a file another app is writing

2007-03-12 Thread John Nagle
Nick Vatamaniuc wrote: > On Mar 11, 3:36 pm, Gordon Airporte <[EMAIL PROTECTED]> wrote: > >>I'm trying to find a way to take a file that another program has opened >>and writes to periodically, open it simultaneously in Python, and >>automatically update some of my objects in Python when the file

Re: backslashes in lists

2007-03-12 Thread Lucas Torri
hehe, só vendo o ['Arquivo de configuracao da arquitetura'] da pra ver que é brasileiro =) I didn't undestand, what didn't worked? I've tryied this, and all went ok: list1 = ['name', 'value'] list2 = ['path', 'c:\some\path'] list3 = [list1, list2] print str(list3).replace('','\\') [['nam

Re: nonlinear interpolation

2007-03-12 Thread Robert Kern
Michele Simionato wrote: > On Mar 12, 5:28 pm, Paul Rubin wrote: >> "Michele Simionato" <[EMAIL PROTECTED]> writes: >>> Any pointer would be well received :) >> Dunno about those libs but it helps to understand the mathematical >> options. Numerical Recipes by Teukolsky

Pydev 1.3.0 Released

2007-03-12 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.0 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: --

Re: using python to visit web sites and print the web sites image to files

2007-03-12 Thread Michael Bentley
> > I wonder whether python can be used to simulate a real user to do the > following: > 1) open a web site in a browser; > 2) printscreen, so to copy the current active window image to > clipboard; > 3) save the image file to a real file > > Any pointer will be apprieciated! Which OS? -- http

Re: New to Python

2007-03-12 Thread Alberto Monteiro
Diez B. Roggisch wrote: > >> Also, basic things like how does "+" operate on object "xxx" >> are impossible to google search. > > For which language they are? > None :-) > And in python you've got the > interpreter loop, either explicitly by invoking python on the > commandline and entering som

Re: Newbie Question : "grep"

2007-03-12 Thread Erik Johnson
Sorry, I forgot to paste the modified version of my code in the post:. I think this is the same behaviour: for line in lines: if "placed" in line: if "i_a/i_b/ROM/" in line: pos = (line.split()[4]).split("_")[1] found = False for (tag, (start, end))

RE: backslashes in lists

2007-03-12 Thread Fabio Gomes
It didn't work. I decided to submit the code in the list.It is a script running with Jython to modify some configurations in the Websphere Application Server that has a Java like command line that interprets jython or jacl. I decided to use Jython.All the properties in that server are stored in

Re: Newbie Question : "grep"

2007-03-12 Thread Erik Johnson
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > - If I increase number of elements I am searching for, then I have > more elif...elif. Is there a cleaner solution? I'm not sure exactly what your lines look like, but this script implies that every line that matches 'i_a/i_b/ROM' is

Re: Python in a desktop environment

2007-03-12 Thread Bruno Desthuilliers
Diez B. Roggisch a écrit : > Bruno Desthuilliers wrote: > >> Grant Edwards a écrit : >> (snip) >> >>> Python is _far_ more robust than C++. >>> >> I wouldn't say so - robustness is a quality of a program, not of a >> language !-) > > Nope. Dealing with dangling references and double frees, comple

Re: New to Python

2007-03-12 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, "Dustan" <[EMAIL PROTECTED]> wrote: > > What is the best way to get documentation about the functions > > and classes of python? I tried to google, but usually I can just > > find the __doc__ of the objects, without examples or anything that > > can help me use it.

Re: backslashes in lists

2007-03-12 Thread Lucas Torri
just like the same way, but replace alist -> list: str(list).replace('','\\') as the time you call str(object) you will have an object of type string, and you can do whatever you want/could do with it... what are you trying?! isn't more interesting use a hash table? On 3/12/07, Fabio Gom

Re: using python to visit web sites and print the web sites image to files

2007-03-12 Thread [EMAIL PROTECTED]
On Mar 12, 7:32 am, "imx" <[EMAIL PROTECTED]> wrote: > I wonder whether python can be used to simulate a real user to do the > following: > 1) open a web site in a browser; > 2) printscreen, so to copy the current active window image to > clipboard; > 3) save the image file to a real file > Any poi

Re: nonlinear interpolation

2007-03-12 Thread Michele Simionato
On Mar 12, 5:28 pm, Paul Rubin wrote: > "Michele Simionato" <[EMAIL PROTECTED]> writes: > > Any pointer would be well received :) > > Dunno about those libs but it helps to understand the mathematical > options. Numerical Recipes by Teukolsky et al has understandable, >

Re: nonlinear interpolation

2007-03-12 Thread Paul Rubin
"Michele Simionato" <[EMAIL PROTECTED]> writes: > Any pointer would be well received :) Dunno about those libs but it helps to understand the mathematical options. Numerical Recipes by Teukolsky et al has understandable, cookbook-like advice about this stuff. I'm told that true numerics gurus sc

Re: programmatically manipulation environment variables of the calling shell

2007-03-12 Thread Diez B. Roggisch
Dennis Lee Bieber wrote: > On Mon, 12 Mar 2007 12:33:58 +0200, "Maxim Veksler" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Hello list, >> >> I'm trying to write a python script that would allow me to manipulate >> shell variables of the calling shell. I'm trying to wr

Re: Newbie Question : "grep"

2007-03-12 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hello, > > I am attempting to write my first Python script to extract some > information from a file, and place it into another file. > (I am trying to find the physical postions of 4 cells within an FPGA) > I have a working solution, and would appreciate any comments. >

Readline()

2007-03-12 Thread Taylor, Stuart
I have been working on running an external process using subprocess.popen for a few days. The process is ran over the network to another machine. One thing I have found is that if I perform readline() on the stdout it will hang if the process loses connection. I have tried a few things in a test e

nonlinear interpolation

2007-03-12 Thread Michele Simionato
I want to interpolate a data distribution with a function depending on various parameters; the function can be a Gaussian, a Breit-Wigner, a custom function. Where should I look? I am getting lost between matplotlib, numeric, numpy, scientific python, scipy, etc. etc. Any pointer would be well rece

Re: Python in a desktop environment

2007-03-12 Thread Diez B. Roggisch
Bruno Desthuilliers wrote: > Grant Edwards a écrit : > (snip) > >> >> Python is _far_ more robust than C++. >> > > I wouldn't say so - robustness is a quality of a program, not of a > language !-) Nope. Dealing with dangling references and double frees, complex copy-semantics that change only

Re: a better solution for GUI in python

2007-03-12 Thread Chris Mellon
On 3/11/07, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Bjoern Schliessmann napisał(a): > > >> I'd recommend pyGTK. It's easy to use, delivers astonishing > >> results and is perfectly portable as far as I know. > > > > And how does it look on Windows? :) > > On styled Windows XP it looks like any oth

Newbie Question : "grep"

2007-03-12 Thread moogyd
Hello, I am attempting to write my first Python script to extract some information from a file, and place it into another file. (I am trying to find the physical postions of 4 cells within an FPGA) I have a working solution, and would appreciate any comments. for line in lines: if "placed" i

Re: Python in a desktop environment

2007-03-12 Thread Grant Edwards
On 2007-03-12, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Grant Edwards a écrit : > (snip) > >> Python is _far_ more robust than C++. > > I wouldn't say so - robustness is a quality of a program, not of a > language !-) IMO, robustness is also a quality of a language. In language like C an

nonlinear interpolation

2007-03-12 Thread Michele Simionato
I want to interpolate a data distribution with a function depending on various parameters; the function can be a Gaussian, a Breit-Wigner, a custom function. Where should I look? I am getting lost between matplotlib, numeric, numpy, scientific python, scipy, etc. etc. Any pointer would be well rece

Re: Python in a desktop environment

2007-03-12 Thread Bruno Desthuilliers
Grant Edwards a écrit : (snip) > > Python is _far_ more robust than C++. > I wouldn't say so - robustness is a quality of a program, not of a language !-) -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >