Re: stdin: processing characters

2006-05-01 Thread Kevin Simmons
Serge Orlov wrote: > Cameron Laird wrote: >> In article <[EMAIL PROTECTED]>, >> Edward Elliott <[EMAIL PROTECTED]> wrote: >>> Kevin Simmons wrote: I have a python script that prompts the user for input from stdin via a menu. I want to process that input when the user types in two charact

using break in exec()

2006-05-01 Thread Weber Matthias
Title: using break in exec() Hi, has anybody a suggestion to get this example to work? I have the need to jump out of the loop within the exec statement. while True:     exec("break") Thanks Matthias -- http://mail.python.org/mailman/listinfo/python-list

Re: self modifying code

2006-05-01 Thread [EMAIL PROTECTED]
First of all, the test can be optimized by adding a boolean flag which indicates if the data has been initialized or not, and then just testing a boolean value instead of doing an "is" comparison, at the cost of an extra global variable. But this is still ugly (actually uglier IMO). I think this

Converting floating point to string in non-scientific format

2006-05-01 Thread Madhusudhanan Chandrasekaran
Hi all: When I try to convert a float variable into string via repr() or str() function, i get the value as is, i.e '0.1e-7' in IEEE 754 format. Instead how can force the created string to represent the floating point in non-scientific fashion (non IEEE 754 format)? i.e something like 0.1

Re: ending a string with a backslash

2006-05-01 Thread Dan Bishop
John Salerno wrote: > I have this: > > subdomain = raw_input('Enter subdomain name: ') > > path = r'C:\Documents and Settings\John Salerno\My Documents\My > Webs\1and1\johnjsalerno.com\' + subdomain > > Obviously the single backslash at the end of 'path' will cause a > problem, and escaping it with

Re: Converting floating point to string in non-scientific format

2006-05-01 Thread Dan Bishop
Madhusudhanan Chandrasekaran wrote: > Hi all: > > When I try to convert a float variable into string via repr() or str() > function, i get the value as is, i.e '0.1e-7' in IEEE 754 format. > Instead how can force the created string to represent the floating > point in non-scientific fashion (non IE

[ANN] markup.py 1.3 - an HTML and XML writer

2006-05-01 Thread Daniel Nogradi
The new 1.3 release of markup.py is available from http://markup.sourceforge.net/ The markup module attempts to make it easier to output HTML or XML from a python program without cluttering your code with tags in a simple and flexible way. Changes * improved documentation * function added t

Re: returning none when it should be returning a list?

2006-05-01 Thread Dan Bishop
Edward Elliott wrote: [in reponse to some prime-number code] > 5. you can do better than checking every odd number (next+2) to find the > next prime, but I'm too tired to look into it right now. it may require > more complex machinery. You only need to check the prime numbers up to sqrt(n). If y

Re: [ANN] markup.py 1.3 - an HTML and XML writer

2006-05-01 Thread Daniel Nogradi
> The new 1.3 release of markup.py is available from > > http://markup.sourceforge.net/ > > The markup module attempts to make it easier to output HTML or XML > from a python program without cluttering your code with tags in a > simple and flexible way. > > Changes > > * improved documentation >

Re: OpenOffice UNO export PDF help needed

2006-05-01 Thread Michele Petrazzo
Sells, Fred wrote: > I've geen googling for 3 days now, and cannot find out how to do > this. > > I'm trying to use OpenOffice 2.0 and UNO to generate PDF documents. > I'm using windows, but will have to make it work under Linux for > production. I've been able to set the parameters and call the >

Re: self modifying code

2006-05-01 Thread Robin Becker
[EMAIL PROTECTED] wrote: > > What have we gained from this? Two major advantages: > * no ugly 'global' statement > * no reliance on the function's name I don't dispute either of the above, however, the actual overhead of your approach appears to be much higher (see below) probably becau

An Atlas of Graphs with Python

2006-05-01 Thread Giandomenico Sica
Call for Cooperation An Atlas of Linguistic Graphs I'm a researcher in graph theory and networks. I'm working about a project connected with the theory and the applications of linguistic graphs, which are mathematical structures useful to represent languages and consequently to manage the organi

Re: python and xulrunner

2006-05-01 Thread James Graham
[EMAIL PROTECTED] wrote: > I've been trying to get xulrunner compiled with python (in windows) but > have been unsuccessful. I've been following this: > . I haven't tried it, but do the instructions at developer.mozilla.or

Re: critique this little script, if you like

2006-05-01 Thread Alexis Roda
John Salerno escribió: > 2. Between the if block or the try block, which is more Pythonic? Since the command line argument is optional I don't think it should be considered and exceptional condition if it's missing, so the "if" block looks better to me. No idea if this is more pythonic. > The

Re: ending a string with a backslash

2006-05-01 Thread Roel Schroeven
John Salerno schreef: > Edward Elliott wrote: >> John Salerno wrote: >>> Obviously the single backslash at the end of 'path' will cause a >>> problem, and escaping it with a backslash seems to fix this problem, but >>> how does escaping work when I already have it as a raw string? >> see the first

Re: critique this little script, if you like

2006-05-01 Thread Roel Schroeven
Dave Jones schreef: > Hi John! > > About the path and the \'s, take a look at the os.path.join function. > The function is smart enough to add the correct slash when joining > directories. But watch out with leading backslashes, as in subdirs = [r'\cgi-bin', r'\images', r'\styles'] os.path.join

Re: critique this little script, if you like

2006-05-01 Thread Roel Schroeven
John Salerno schreef: > John Salerno wrote: >> Dave Jones wrote: >>> Hi John! >>> >>> About the path and the \'s, take a look at the os.path.join function. >>> The function is smart enough to add the correct slash when joining >>> directories. >>> >>> Dave >> Interesting, thanks! I was reading abou

noob question: "TypeError" wrong number of args

2006-05-01 Thread Holger
Hi guys Tried searching for a solution to this, but the error message is so generic, that I could not get any meaningfull results. Anyways - errormessage: TypeError: addFile() takes exactly 1 argument (2 given) -

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread Fredrik Lundh
Holger wrote: > Tried searching for a solution to this, but the error message is so > generic, that I could not get any meaningfull results. > > Anyways - errormessage: > > TypeError: addFile() takes exactly 1 argument (2 given) > --

Re: basic python programing

2006-05-01 Thread Steve Holden
Grant Edwards wrote: > On 2006-04-30, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>here we discuss the most basic concepts about python. > > > Yes we do. > > As well as the most basic concepts about Usenet. > Yes, sir. BasicConceptsRUs. regards Steve -- Steve Holden +44 150

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread Holger
oops, that was kinda embarrassing. But thx anyway :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: python and xulrunner

2006-05-01 Thread joe . hrbek
Well, it's my understanding (I could be wrong), that pyxpcom is to enable firefox/mozilla to use python. My interest is more in the area of xulrunner. I've read that page several times and pulled compiler/linker build steps from it, but never followed it exactly. I suppose I can try pyxpcom inste

Re: SPE / winpdb problem

2006-05-01 Thread Steve Holden
MakaMaka wrote: > Hi All, > I'm having a problem with Stani's Python Editor (SPE) that I'm hoping > somebody has run into before. If I create a simple hello world > program: > > print "hello" > > and try and run it in winpdb via the SPE command ALT-F9, the program > does not launch and the follo

Re: using break in exec()

2006-05-01 Thread Steve Holden
Weber Matthias wrote: > Hi, > > has anybody a suggestion to get this example to work? I have the need to > jump out of the loop within the exec statement. > > while True: > exec("break") > You can't do that, just as you can't break out of a loop by executing a break within a function that

Re: How to prevent this from happening?

2006-05-01 Thread Serge Orlov
[EMAIL PROTECTED] wrote: > Regarding this expression: 1 << x > > I had a bug in my code that made x become Very Large - much larger than > I had intended. This caused Python, and my PC, to lock up tight as a > drum, and it appeared that the Python task (Windows XP) was happily and > rapidly consum

Re: returning none when it should be returning a list?

2006-05-01 Thread Roy Smith
[EMAIL PROTECTED] wrote: Several people have already given you good answers as to why you're getting None, and how to improve the algorithm you're using. I want to address some stylistic questions. First, is the > if(next >= lim): > print(seed) > return seed > else: >

Re: OOP techniques in Python

2006-05-01 Thread Philippe Martin
Thanks, Did not know that. Philippe Dennis Lee Bieber wrote: > On Thu, 27 Apr 2006 14:32:15 -0500, Philippe Martin > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> >> What then is the point of the double underscore (if any) ?: > > To prevent masking/shadowing of inhe

Re: stdin: processing characters

2006-05-01 Thread Serge Orlov
Kevin Simmons wrote: > Thanks for your input. I found an answer that suits my needs, not curses > :-), but stty settings and sys.stdin.read(n) : > > import os, sys > > while 1: > os.system("stty -icanon min 1 time 0") > print """ > Radio computer control program. > -

Re: installing pyodbc

2006-05-01 Thread timw.google
No I didn't. Thanks for the reply. I've moved on to mx.ODBC. -- http://mail.python.org/mailman/listinfo/python-list

Python based file format cracking

2006-05-01 Thread Wesley Brooks
Dear Users,Is there another tool that can examine an string for undefined repeating patterns? I'm aware of and have limited experience regular expressions which finds supplied patterns within a string. Yours Faithfully, Wesley Brooks -- http://mail.python.org/mailman/listinfo/python-list

Re: Measure memory usage in Python

2006-05-01 Thread Rune Strand
gene tani wrote: > Rune Strand wrote: > > Is there a way to measure how much memory a data structure use? For > > instance, what is the footprint of a particular list object like > > [0,1,2,3,4,5,6,7,8,9]? > > i have a note to try this, but haven't got around to it, if you want to > blog/post > >

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread Ben Finney
"Holger" <[EMAIL PROTECTED]> writes: > > TypeError: addFile() takes exactly 1 argument (2 given) > > > > import sys > > class KeyBase: >

Re: self modifying code

2006-05-01 Thread [EMAIL PROTECTED]
Yes, my implementation was less efficient because of the extra function call. > class Weird(object): > @staticmethod > def __call__(arg): > data = 42 > def func(arg): > return arg+data > Weird.__call__ = static

Re: Measure memory usage in Python

2006-05-01 Thread gene tani
Rune Strand wrote: > gene tani wrote: > > Rune Strand wrote: > > > Is there a way to measure how much memory a data structure use? For > > > instance, what is the footprint of a particular list object like > > > [0,1,2,3,4,5,6,7,8,9]? > > > > i have a note to try this, but haven't got around to it

Re: returning none when it should be returning a list?

2006-05-01 Thread randomtalk
John Machin wrote: > > That's because it "falls off the end" of the function, which causes it > to return None. However that's not your only problem. Major other > problem is updating "seed" in situ. > I'm not sure what "falls off the end" of the function means, i searched online, it seems to mean

regd efficient methods to manipulate *large* files

2006-05-01 Thread Madhusudhanan Chandrasekaran
Hi: This question is not directed "entirely" at python only. But since I want to know how to do it in python, I am posting here. I am constructing a huge matrix (m x n), whose columns n are stored in smaller files. Once I read m such files, my matrix is complete. I want to pass this matr

Re: python and xulrunner

2006-05-01 Thread Michel Claveau
Hi! My answer is (perhaps a little) hard, but... I read pages and pages, and traversed sites and sites. Conclusion : - XPcom functions, perhaps, on some special configurations. - xulrunner is an idea (vapor?) But, in production, nothing of all that is usable (for the moment?) -- @-salutati

Re: ending a string with a backslash

2006-05-01 Thread John Salerno
Roel Schroeven wrote: > I think this is also the right time to mention os.path.join. Yeah, I ended up using this and it looks a lot nicer too. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: critique this little script, if you like

2006-05-01 Thread John Salerno
Roel Schroeven wrote: > But watch out with leading backslashes, as in > > subdirs = [r'\cgi-bin', r'\images', r'\styles'] > > os.path.join will assume they are meant to be absolute paths, and will > discard all previous components: > > >>> os.path.join('base', 'subdomain', r'\images') > '\\im

Re: critique this little script, if you like

2006-05-01 Thread John Salerno
Alexis Roda wrote: > John Salerno escribió: >> 2. Between the if block or the try block, which is more Pythonic? > > Since the command line argument is optional I don't think it should be > considered and exceptional condition if it's missing, so the "if" block > looks better to me. No idea if

Re: How to efficiently read binary files?

2006-05-01 Thread Grant Edwards
On 2006-04-30, Robert Kern <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2006-04-30, David Lees <[EMAIL PROTECTED]> wrote: >> >>>I want to process large binary files (>2GB) in Python. I have played >>>around with prototypes in pure Python and profiled the code. Most of >>>the time se

Re: self modifying code

2006-05-01 Thread Robin Becker
[EMAIL PROTECTED] wrote: > Yes, my implementation was less efficient because of the extra function > call. > >> class Weird(object): >> @staticmethod >> def __call__(arg): >> data = 42 >> def func(arg): >> return arg+data >>

Re: returning none when it should be returning a list?

2006-05-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > John Machin wrote: > > > > That's because it "falls off the end" of the function, which causes it > > to return None. However that's not your only problem. Major other > > problem is updating "seed" in situ. > > > I'm not sure what "falls off the end" of the function mea

Setting a module package to use new-style classes

2006-05-01 Thread Panos Laganakos
Is there a way to have a whole module package use the new-style classes, without having to specify it per module-file or even worse, per class definition? Maybe by declaring the __metaclass__ in the module's __init__.py? -- http://mail.python.org/mailman/listinfo/python-list

list*list

2006-05-01 Thread BBands
There must be a better way to multiply the elements of one list by another: a = [1,2,3] b = [1,2,3] c = [] for i in range(len(a)): c.append(a[i]*b[i]) a = c print a [1, 4, 9] Perhaps a list comprehension or is this better addressed by NumPy? Thanks, jab -- http://mail.python.org/

Re: list*list

2006-05-01 Thread Tim Williams
On 1 May 2006 08:28:12 -0700, BBands <[EMAIL PROTECTED]> wrote: There must be a better way to multiply the elements of one list byanother:a = [1,2,3]b = [1,2,3]c = []for i in range(len(a)):c.append(a[i]*b[i])a = cprint a[1, 4, 9] Something like: >>> [ x * y  for x,y in zip(a,b) ] [1, 4, 9

Re: list*list

2006-05-01 Thread Diez B. Roggisch
> There must be a better way to multiply the elements of one list by > another: > > a = [1,2,3] > b = [1,2,3] > c = [] > for i in range(len(a)): > c.append(a[i]*b[i]) > a = c > print a > [1, 4, 9] > > Perhaps a list comprehension or is this better addressed by NumPy? First of all: it's consider

Re: critique this little script, if you like

2006-05-01 Thread Alexis Roda
John Salerno escribió: > Alexis Roda wrote: >> >> > The >> > try block seems nicer because it doesn't have such an ugly-looking >> check >> > to make. >> > > Why do you think that this try block is preferred over what I have (if I > were to stick with the try block)? My example has nothing t

Re: Converting floating point to string in non-scientific format

2006-05-01 Thread ernesto . adorio
See also non-exponential floating point representation in http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/358361 by R. Hettinger. -- http://mail.python.org/mailman/listinfo/python-list

Re: list*list

2006-05-01 Thread Tim Chase
> There must be a better way to multiply the elements of one list by > another: > > a = [1,2,3] > b = [1,2,3] > c = [] > for i in range(len(a)): > c.append(a[i]*b[i]) > a = c > print a > [1, 4, 9] > > Perhaps a list comprehension or is this better addressed by NumPy? a = [1,2,3] b = [1,2,3

[ANN] Movable Python 1.0.2

2006-05-01 Thread Fuzzyman
`Movable Python 1.0.2 `_ is now available. This release if for the Python 2.4 distribution of **Movable Python**, and is now available for `download `_. Features new to this release include : * Now built with Py

Re: An Atlas of Graphs with Python

2006-05-01 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Giandomenico Sica <[EMAIL PROTECTED]> wrote: > Call for Cooperation >An Atlas of Linguistic Graphs > >I'm a researcher in graph theory and networks. >I'm working about a project connected with the theory and the applications >of >linguistic graphs, which are mathema

Re: Using a browser as a GUI: which Python package

2006-05-01 Thread Jacob Rael
I am looking for the samething. I was thinking of Karrigell. http://karrigell.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Multi-Monitor Support

2006-05-01 Thread Mark rainess
Hello, Does Python or wxPython include any support for multiple monitors. In my application multiple monitors are located at a distance. It is not convenient to move a window from the main monitor to one of the others. I want to have the option to open an an application on any connected monit

Numeric, vectorization

2006-05-01 Thread RonnyM
Hello. I want to vectorize this operation, which below is implemented as a for-loop: def smoothing_loop( y ): #y is an array with noisy values ybar = [] ybar.append( y[0] ) #Smoothing with a loop length = size( y ) for i in range( 1, length -1 ): ybar.append( .5 *

how to do with the multi-frame GIF

2006-05-01 Thread liupei
how to do with the multi-frame GIF, I used the PIL ,but it seems not support? -- http://mail.python.org/mailman/listinfo/python-list

how to do with the multi-frame GIF

2006-05-01 Thread liupei
how to do with the multi-frame GIF, I used the PIL ,but it seems not support? -- http://mail.python.org/mailman/listinfo/python-list

how to do with the multi-frame GIF

2006-05-01 Thread liupei
how to do with the multi-frame GIF, I used the PIL ,but it seems not support? -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric, vectorization

2006-05-01 Thread David Isaac
"RonnyM" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > e.g. y = [ 1, 2, 3, 4, 5, 6 ,7 ,8, 9 ] > ybar = [ 1, (1 + 3)*.5,(2 + 4)*.5,(3 + 5)*.5,..., (n-1 + n+1)*.5 ], n = > 1,...len(y) -1 > How do I make a vectorized version of this, I will prefer not to > utilize Map or similar funct

Re: self modifying code

2006-05-01 Thread [EMAIL PROTECTED]
Personally, I would almost always pay the x2 efficiency price in order to use a class. But then I don't know what you're writing. Of course, if you really need it to be efficient, you can write it as a C extension, or use Pyrex, etc. and get -much- better results. -- http://mail.python.org/mailm

Re: How to efficiently read binary files?

2006-05-01 Thread Robert Kern
Grant Edwards wrote: > On 2006-04-30, Robert Kern <[EMAIL PROTECTED]> wrote: > >>Grant Edwards wrote: >>>Perhaps the numarray module? >> >>numpy for new code, please. > > So numarray and numpy were both written to replace numeric? numpy was written to replace both Numeric and numarray. There is

Re: list*list

2006-05-01 Thread David Isaac
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > it's considered bad style to use range if all you want is a > enumeration of indices, as it will actually create a list of the size you > specified. Use xrange in such cases. I'm pretty sure this distinction goes away

Re: How to efficiently read binary files?

2006-05-01 Thread Grant Edwards
On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: Perhaps the numarray module? >>> >>>numpy for new code, please. >> >> So numarray and numpy were both written to replace numeric? > > numpy was written to replace both Numeric and numarray. too many batteries... ;) -- Grant Edwards

Re: list*list

2006-05-01 Thread Fredrik Lundh
David Isaac wrote: > > it's considered bad style to use range if all you want is a > > enumeration of indices, as it will actually create a list of the size you > > specified. Use xrange in such cases. > > I'm pretty sure this distinction goes away in 2.5. 3.0. and for short sequences, it doesn'

Re: list*list

2006-05-01 Thread Diez B. Roggisch
> and for short sequences, it doesn't really matter much in the 2.X series. > it's definitely not "bad style" to use range instead of xrange for a ten > to, say, 1000 item loop. You and me are aware of that - but I figured the OP wasn't. And just the other day somebody on de.c.l.py wondered about

Re: Add file to zip, or replace file in zip

2006-05-01 Thread Scott David Daniels
Edward Elliott wrote: > Scott David Daniels wrote: >>... > ... You windows kids and your crazy data formats. There were a few oth OS's than Linux and Windows. Maybe you should call me "you crazy Tenex kid." Knuth says, "the fastest way to search is to know where to go." -- Zips have locations of

Re: how to do with the multi-frame GIF

2006-05-01 Thread Daniel Nogradi
> how to do with the multi-frame GIF, I used the PIL ,but it seems not > support? The source distribution of the 1.1.4 version comes with a Scripts directory where you can find player.py, gifmaker.py and explode.py which all deal with animated gif. I don't know if they work with version 1.1.5 thou

Re: how to do with the multi-frame GIF

2006-05-01 Thread Fredrik Lundh
Daniel Nogradi wrote: > The source distribution of the 1.1.4 version comes with a Scripts > directory where you can find player.py, gifmaker.py and explode.py > which all deal with animated gif. I don't know if they work with > version 1.1.5 though. they're still shipped with 1.1.5 (and 1.1.6), a

Re: How to efficiently read binary files?

2006-05-01 Thread Robert Kern
Grant Edwards wrote: > On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: > >Perhaps the numarray module? numpy for new code, please. >>> >>>So numarray and numpy were both written to replace numeric? >> >>numpy was written to replace both Numeric and numarray. > > too many batter

Re: How to efficiently read binary files?

2006-05-01 Thread Grant Edwards
On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: >> >>Perhaps the numarray module? > >numpy for new code, please. So numarray and numpy were both written to replace numeric? >>> >>>numpy was w

Re: How to efficiently read binary files?

2006-05-01 Thread Robert Kern
Grant Edwards wrote: > On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: > >>Grant Edwards wrote: >> >>>On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: >>> >>>Perhaps the numarray module? >> >>numpy for new code, please. > >So numarray and numpy were both written to r

Re: list*list

2006-05-01 Thread Klaas
Diez wrote: > First of all: it's considered bad style to use range if all you want is a > enumeration of indices, as it will actually create a list of the size you > specified. Use xrange in such cases. > But maybe nicer is zip: > c = [av * bv for av, bv in zip(a, b)] By your logic, shouldn't it

Re: returning none when it should be returning a list?

2006-05-01 Thread Dave Hughes
Edward Elliott wrote: > [EMAIL PROTECTED] wrote: > > The function basically takes in a list of all the prime number > > found, it takes the next number to be tested for (next) and the > > limit it will go up to. It divide next by the list of previous > > prime numbers if next is not bigger than li

How do I take a directory name from a given dir?

2006-05-01 Thread Merrigan
Hi, I am trying to write a script to backup all my company's server configs weekly. The script will run in a cronjob, on whatever I set it. The issue I am currently having isto "extract" the directory name from a given directory string. For example: from the string "/home/testuser/projects/" I ne

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Daniel Nogradi
> Hi, > > I am trying to write a script to backup all my company's server configs > weekly. The script will run in a cronjob, on whatever I set it. > > The issue I am currently having isto "extract" the directory name from > a given directory string. For example: from the string > "/home/testuser/p

Passing events

2006-05-01 Thread Wesley Brooks
Dear Users,Is it possible to pass events such as keyboard, mouse, and joystick events to any software application and take screen shots? In this example I would like to be able to control a car racing game using python script. Is it difficult to recieve and create events from devices like the steer

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Merrigan Took
Daniel Nogradi wrote: >> Hi, >> >> I am trying to write a script to backup all my company's server configs >> weekly. The script will run in a cronjob, on whatever I set it. >> >> The issue I am currently having isto "extract" the directory name from >> a given directory string. For example: from t

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Mike Kent
Python 2.4.2 (#1, Nov 29 2005, 14:04:55) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> d = "/home/testuser/projects" >>> os.path.basename(d) 'projects' >>> os.path.dirname(d) '/home/testuser' >>> --

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Fredrik Lundh
"Merrigan" wrote: > I am trying to write a script to backup all my company's server configs > weekly. The script will run in a cronjob, on whatever I set it. > > The issue I am currently having isto "extract" the directory name from > a given directory string. For example: from the string > "/home

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Michael Ekstrand
On Mon, May 01, 2006 at 12:42:58PM -0700, Merrigan wrote: > The issue I am currently having isto "extract" the directory name from > a given directory string. For example: from the string > "/home/testuser/projects/" I need to extract the "projects" part. The > problem is that the directory names t

Re: How to efficiently read binary files?

2006-05-01 Thread Grant Edwards
On 2006-05-01, Robert Kern <[EMAIL PROTECTED]> wrote: > Oh, I saw the smiley. I knew it was meant to be humorous. I > just didn't understand it. The only "batteries" reference I > know of in this context is the "batteries included" philosophy > of the stdlib. Of course, none of Numeric, numarray,

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Steve Poe
Daniel,Before writing your script, what is your general approach to backup configuration files? Do you tar/zip them into one file? Do you ftp/ssh each file to another server? One approach I've used in backing up files from another server is: from ftplib import FTPdef handleDownload(block):    file.

using ftplib

2006-05-01 Thread John Salerno
I'm experimenting with this now and I'm a little confused about transferring commands. This might be more of an FTP question than strictly Python, but it's still related to how to use the ftplib methods. Anyway, if what I want to do is send a command to change the file permission settings of a

Re: regd efficient methods to manipulate *large* files

2006-05-01 Thread Dave Hughes
Madhusudhanan Chandrasekaran wrote: > Hi: > > This question is not directed "entirely" at python only. But since > I want to know how to do it in python, I am posting here. > > > I am constructing a huge matrix (m x n), whose columns n are stored in > smaller files. Once I read m such fil

Re: stdin: processing characters

2006-05-01 Thread Russ Salsbury
Serge Orlov wrote: > Kevin Simmons wrote: > > Looks reasonable if you don't need portability. But you may want to > refactor it a little bit to make sure terminal setting are always > restored: > > try: > do_all_the_work() > finally: > os.system("stty cooked") > IIRC You need to do "stty

Re: How do I take a directory name from a given dir?

2006-05-01 Thread Merrigan
WOW, Thanks guys. I am really awestruck by the speed you guys relied with. Thanks a lot for the help. I eventually found a way that did the job for me. I will definitely visit this Group more often. Thanks for all the help! :D -- http://mail.python.org/mailman/listinfo/python-list

[ANN] markup.py 1.4 - bugfix

2006-05-01 Thread Daniel Nogradi
I'm terribly sorry but there was a crucial bug left in the 1.3 release announced today. Thanks to a user now it's fixed, and the new 1.4 release is available on http://markup.sourceforge.net/ which should be okay. Sorry for the inconvenience :) -- http://mail.python.org/mailman/listinfo/python-li

Could not find platform independent libraries

2006-05-01 Thread pythonhelpneeded
While building Python 2.4.3 on SCO OpenServer 5.0.5, I'm getting the error below. The modules mentioned seem to be available in the Lib subdirectory. I've tried setting PYTHONHOME to the build directory (/tmp/Python-2.4.3), it didn't help. Any help would be appreciated. # make case $MAK

Re: Add file to zip, or replace file in zip

2006-05-01 Thread Edward Elliott
Scott David Daniels wrote: > Edward Elliott wrote: >> Scott David Daniels wrote: >>>... > > ... You windows kids and your crazy data formats. > There were a few oth OS's than Linux and Windows. Maybe you > should call me "you crazy Tenex kid." Windows popularized the zip format, but if you in

Re: using ftplib

2006-05-01 Thread Dave Hughes
John Salerno wrote: > I'm experimenting with this now and I'm a little confused about > transferring commands. This might be more of an FTP question than > strictly Python, but it's still related to how to use the ftplib > methods. > > Anyway, if what I want to do is send a command to change the

Difference between threading.local and protecting data with locks

2006-05-01 Thread juxstapose
Hello, I have been develop a blocking socket application with threading. The main thread handles connections and inserts them into python's protected queue as jobs for the thread pool to handle. There is not much information on threading.local except that it states that in maintains variable uniq

Re: python about mobile game?

2006-05-01 Thread cyberco
http://sourceforge.net/projects/pys60 -- http://mail.python.org/mailman/listinfo/python-list

Re: list*list

2006-05-01 Thread Diez B. Roggisch
Klaas schrieb: > Diez wrote: >> First of all: it's considered bad style to use range if all you want is a >> enumeration of indices, as it will actually create a list of the size you >> specified. Use xrange in such cases. > >> But maybe nicer is zip: >> c = [av * bv for av, bv in zip(a, b)] > >

Re: regd efficient methods to manipulate *large* files

2006-05-01 Thread Paddy
I take it that you have a binary file that takes a file name and proceses the file contents. Sometimes Unix binaries are written so that a file name of '-', (just a dash), causes it to take input from stdin so that the piping mentioned in a previous reply could work. On some of our unix systems /tm

Re: An Atlas of Graphs with Python

2006-05-01 Thread Paddy
A little off topic I'm afraid Giandomenico, But I had to smile. Here is someone working in the field of linguistics, who wants a programming solution, in the language Python. (It's Larry Wall, creator of Perl that cites his linguistic foundations). -- Pad. -- http://mail.python.org/mailman/list

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread Holger
I guess I deserved that. :-( I *did* read the tutorial, but then I forgot and didn't notice... My brain is getting is slow - so thx for the friendly slap in the face ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: using ftplib

2006-05-01 Thread John Salerno
Dave Hughes wrote: > Indeed. FTP is a tricky (and _very_ old) protocol that does things in a > very different manner to the later (simpler) protocols like HTTP. Not > sure how familiar you are with FTP, so my apologies if I wind up > repeating stuff you know already: Thanks very much, all that in

Re: Setting a module package to use new-style classes

2006-05-01 Thread Ben Finney
"Panos Laganakos" <[EMAIL PROTECTED]> writes: > Is there a way to have a whole module package use the new-style > classes, without having to specify it per module-file or even worse, > per class definition? TTBOMK, you do that with a single statement per module, before any class definitions:

Re: Add file to zip, or replace file in zip

2006-05-01 Thread Scott David Daniels
Edward Elliott wrote: > Scott David Daniels wrote: > >> Edward Elliott wrote: >>> Scott David Daniels wrote: ... >> > ... You windows kids and your crazy data formats. >> There were a few oth OS's than Linux and Windows. Maybe you >> should call me "you crazy Tenex kid." > > Windows popu

Re: noob question: "TypeError" wrong number of args

2006-05-01 Thread Edward Elliott
Holger wrote: > oops, that was kinda embarrassing. It's really not. You got a completely unhelpful error message saying you passed 2 args when you only passed one explicitly. The fact the b is also an argument to b.addfile(f) is totally nonobvious until you know that 1) b is an object not a modu

  1   2   >