Re: Co-developers wanted: document markup language

2007-08-23 Thread Torsten Bronger
Hallöchen! Aahz writes: > Torsten Bronger <[EMAIL PROTECTED]> wrote: > >> Aahz writes: >> >>> Torsten Bronger <[EMAIL PROTECTED]> wrote: >>> Some LaTeX users in Aachen thought about a general-use markup language this spring. I wrote some code and a rough project description, how

Re: List Comprehension Question: One to Many Mapping?

2007-08-23 Thread Paul Rubin
beginner <[EMAIL PROTECTED]> writes: > For example, if I have x=[ [1,2], [3,4] ] > > What I want is a new list of list that has four sub-lists: > > [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]] [[a, map(f,a)] for a in x] -- http://mail.python.org/mailman/listinfo/python-list

online doc bug

2007-08-23 Thread nair . jitendra
hyperlink "site module documentation" in Section 4.1 on page http://docs.python.org/inst/search-path.html leads to a nonexistent page. Regards jitendra nair -- http://mail.python.org/mailman/listinfo/python-list

Re: unifying many packages under one name

2007-08-23 Thread James Stroud
Eric S. Johansson wrote: > I have a collection of packages and I want to put them under single > unifying name. my goal is to reduce namespace pollution and make all > these packages accessible as 'import vvv.aaa'. In more detail, if I have > packages 'aaa' and 'bbb', what do I do to put those

Re: unifying many packages under one name

2007-08-23 Thread Peter Otten
Eric S. Johansson wrote: > I have a collection of packages and I want to put them under single > unifying > name. my goal is to reduce namespace pollution and make all these > packages accessible as 'import vvv.aaa'. In more detail, if I have > packages 'aaa' and 'bbb', what do I do to put those

Re: List Comprehension Question: One to Many Mapping?

2007-08-23 Thread beginner
On Aug 24, 12:41 am, Davo <[EMAIL PROTECTED]> wrote: > On Aug 23, 9:24 pm, beginner <[EMAIL PROTECTED]> wrote: > > > > > > > Hi All, > > > How do I map a list to two lists with list comprehension? > > > For example, if I have x=[ [1,2], [3,4] ] > > > What I want is a new list of list that has four

Re: List Comprehension Question: One to Many Mapping?

2007-08-23 Thread Davo
On Aug 23, 9:24 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi All, > > How do I map a list to two lists with list comprehension? > > For example, if I have x=[ [1,2], [3,4] ] > > What I want is a new list of list that has four sub-lists: > > [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]] > > [1,2] is ma

Re: beginner, idiomatic python

2007-08-23 Thread Erik Max Francis
bambam wrote: > Excellent. By symmetry, I see that "list" casts the set back into a list. > > I wonder why list has not been extended with the same (difference, > interesection) methods? Casting to set looks a little kludgy: > > c = list(set(a)-set(b)) > I wonder if that is clearer than the exp

Re: List Comprehension Question: One to Many Mapping?

2007-08-23 Thread Peter Otten
beginner wrote: > How do I map a list to two lists with list comprehension? > > For example, if I have x=[ [1,2], [3,4] ] > > What I want is a new list of list that has four sub-lists: > > [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]] > > [1,2] is mapped to [1,2] and [f(1), f(2)] and [3,4] is map

Re: beginner, idiomatic python

2007-08-23 Thread bambam
Excellent. By symmetry, I see that "list" casts the set back into a list. I wonder why list has not been extended with the same (difference, interesection) methods? Casting to set looks a little kludgy: c = list(set(a)-set(b)) I wonder if that is clearer than the explicit loop? Steve. "Gabrie

Re: List Comprehension Question: One to Many Mapping?

2007-08-23 Thread [EMAIL PROTECTED]
On Aug 23, 9:24 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi All, > > How do I map a list to two lists with list comprehension? > > For example, if I have x=[ [1,2], [3,4] ] > > What I want is a new list of list that has four sub-lists: > > [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]] > > [1,2] is ma

Re: beginner, idiomatic python

2007-08-23 Thread bambam
Wos! Several different thoughts: An object using yield to return only the relevant pages, one at a time. Pop to remove the items from the list. A dictionary to map between the strings and the integers. The dictionary was particularly unexpected. Eventually, I plan to change the string ports to de

Re: beginner, idiomatic python

2007-08-23 Thread bambam
Thank you, so generallizing: (1) Python re-evaluates the loop range on every loop, and (2) Python does short-circuit evaluation of conditions, in predictable order. Sorry about the bad question. "Zentrader" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Does page count change?

List Comprehension Question: One to Many Mapping?

2007-08-23 Thread beginner
Hi All, How do I map a list to two lists with list comprehension? For example, if I have x=[ [1,2], [3,4] ] What I want is a new list of list that has four sub-lists: [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]] [1,2] is mapped to [1,2] and [f(1), f(2)] and [3,4] is mapped to [3,4], [f(3), f(4)]

Re: Socket recv(1) seems to block instead of returning end of file.

2007-08-23 Thread Bryan Olson
Grant Edwards wrote: [...] > import socket,random > > HOST = '' # Symbolic name meaning the local host > PORT = 8765 # Arbitrary non-privileged port > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > s.connect((HOST, PORT)) Actually the empty string passed for

Re: creating a tar file with python

2007-08-23 Thread John McMonagle
Brian McCann wrote: > Hi, > > I'm trying to create a tar file of the contents of the current directory > > right now there is only one file "text.xml" in the current dir, I'm > using"." current dir as source > but that gives syntax error > > any help would be greatly appreciated > --Brian >

unifying many packages under one name

2007-08-23 Thread Eric S. Johansson
I have a collection of packages and I want to put them under single unifying name. my goal is to reduce namespace pollution and make all these packages accessible as 'import vvv.aaa'. In more detail, if I have packages 'aaa' and 'bbb', what do I do to put those packages under unifying name such

Re: beginner, idiomatic python

2007-08-23 Thread Gabriel Genellina
En Thu, 23 Aug 2007 23:54:14 -0300, bambam <[EMAIL PROTECTED]> escribi�: > After examining your suggestion, I realised that another thing > I am interested in could be generalised: I want the complement > of the set of ports in pages, given a universal set in tempList. > Ignoring the break conditi

Re: advice about `correct' use of decorator

2007-08-23 Thread Gabriel Genellina
En Thu, 23 Aug 2007 09:20:21 -0300, BJörn Lindqvist <[EMAIL PROTECTED]> escribi�: > On 8/22/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> On 22 ago, 10:00, "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: >> > As I said, you can accomplish the exact same thing by calling a >> > function from w

Re: creating a tar file with python

2007-08-23 Thread Steve Holden
Steve Holden wrote: > Brian McCann wrote: >> >> >> Steve, >> >> I ran the code as you suggested, didn't work, tried variations of it >> didn't work, >> If you don't know the answer don't pretend you do! >> >> Apology not accepted, please don't wake up! >> >> Future c

Re: optparse - required options

2007-08-23 Thread Steve Holden
Steven Bethard wrote: > Omari Norman wrote: >> On Mon, Aug 20, 2007 at 05:31:00PM -0400, Jay Loden wrote: >>> Robert Dailey wrote: Well, I don't know what is wrong with people then. I don't see how required arguments are of bad design. >>> I tend to agree...while "required option" may be

Re: Making a file-like object for manipulating a large file

2007-08-23 Thread Steve Holden
Sean Davis wrote: > This should be a relatively simple problem, but I haven't quite got > the idea of how to go about it. I have a VERY large file that I would > like to load a line at a time, do some manipulations on it, and then > make it available to as a file-like object for use as input to a

Re: beginner, idomatic python 2

2007-08-23 Thread Dan Bishop
On Aug 23, 10:21 pm, "bambam" <[EMAIL PROTECTED]> wrote: > Would someone like to suggest a replacement for this? This is a > function that returns different kinds of similar objects, depending > on what is asked for. PSP and PWR are classes. I don't really > want to re-write the calling code very

Re: Xah's Edu Corner: Under the spell of Leibniz's dream

2007-08-23 Thread Steve Holden
Twisted wrote: > On Aug 23, 3:38 am, Matthias Buelow <[EMAIL PROTECTED]> wrote: >> In comp.lang.lisp Bikal KC <[EMAIL PROTECTED]> wrote: >> >>> I used usenet years ago then stopped for couple of years. I remember >>> seeing him/her on c.l.perl I believe doing the same thing he/she is >>> doing atm.

Re: IDE for Python

2007-08-23 Thread Steve Holden
Ricardo Aráoz wrote: > I V wrote: >> On Tue, 21 Aug 2007 21:23:25 -0300, Ricardo Aráoz wrote: >>> Do you know if for in-house development a GPL license applies? (Qt4 >>> and/or Eric4). >> (I'm not sure if I've understood your question right) >> >> If you distribute an app that _uses_ PyQT, you

Re: creating a tar file with python

2007-08-23 Thread Steve Holden
Brian McCann wrote: > > > Steve, > > I ran the code as you suggested, didn't work, tried variations of it > didn't work, > If you don't know the answer don't pretend you do! > > Apology not accepted, please don't wake up! > > Future correspondence on any python que

RE: creating a tar file with python

2007-08-23 Thread Brian McCann
Steve, I ran the code as you suggested, didn't work, tried variations of it didn't work, If you don't know the answer don't pretend you do! Apology not accepted, please don't wake up! Future correspondence on any python questions from you go to trash. May your pil

beginner, idomatic python 2

2007-08-23 Thread bambam
Would someone like to suggest a replacement for this? This is a function that returns different kinds of similar objects, depending on what is asked for. PSP and PWR are classes. I don't really want to re-write the calling code very much: I'm just wondering if the function can be replaced with som

Re: creating a tar file with python

2007-08-23 Thread Steve Holden
Brian McCann wrote: > > Hi, > > I'm now getting this error > any ideas? > Thanks, > Brian > > > Traceback (most recent call last): > File "./tarup.py", line 25, in ? > tar = tarfile.open("test.xml","sample.tar.gz", 'w:gz') > File "/usr/lib64/python2.4/tarfile.py", line 929, in open >

Re: creating a tar file with python

2007-08-23 Thread Steve Holden
Brian McCann wrote: > > Hi, > > I tried Steve's solution but get this error > using the tar script below > --Brian > > tar = tarfile.open(".","test.tar.gz",w:gz) > [EMAIL PROTECTED] tmp]$ ./tarup.py > File "./tarup.py", line 24 > tar = tarfile.open(".","test.tar.gz",w:gz) >

Summer Comic Relief in Python

2007-08-23 Thread SamFeltus
SonomaSunshine runs well on Django now... http://samfeltus.com/django/DjangoSummer.html (Use flowers to navigate to 10 scenes, no preloader, ~6mb) SonomaSunshine, the Redneck Riviera's Best Python Powered Folk Art Server, makes it easy to generate Cartoonish backdrops for Flash movies in Django.

Re: optparse - required options

2007-08-23 Thread Steven Bethard
Omari Norman wrote: > On Mon, Aug 20, 2007 at 05:31:00PM -0400, Jay Loden wrote: >> Robert Dailey wrote: >>> Well, I don't know what is wrong with people then. I don't see how >>> required arguments are of bad design. > >> I tend to agree...while "required option" may be an oxymoron in >> English,

Re: beginner, idiomatic python

2007-08-23 Thread bambam
Wos! Several different thoughts: An object using yield to return only the relevant pages, one at a time. Pop to remove the items from the list. A dictionary to map between the strings and the integers. The dictionary was particularly unexpected. Eventually, I plan to change the string ports to de

Re: redirect or cover .bat log

2007-08-23 Thread Gabriel Genellina
En Thu, 23 Aug 2007 03:42:52 -0300, <[EMAIL PROTECTED]> escribi�: > On 22 kol, 21:18, [EMAIL PROTECTED] wrote: >> On 22 kol, 16:01, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> > > > >> > Can I cover or redirect log of that process into my wx >> program? >> > > > >> > I'am using Windows XP

Re: MsiLib

2007-08-23 Thread Martin v. Löwis
> Thank you. I would be willing to help out, but as of now I have no idea > how to get started on it. If you would be willing to provide some > guidance, then I would be fine with giving it a shot if nothing more. My > guess is that it would have to implement the MsiRecordGetString function > so th

Making a file-like object for manipulating a large file

2007-08-23 Thread Sean Davis
This should be a relatively simple problem, but I haven't quite got the idea of how to go about it. I have a VERY large file that I would like to load a line at a time, do some manipulations on it, and then make it available to as a file-like object for use as input to a database module (psycopg2)

RE: creating a tar file with python

2007-08-23 Thread Brian McCann
Hi, I'm now getting this error any ideas? Thanks, Brian Traceback (most recent call last): File "./tarup.py", line 25, in ? tar = tarfile.open("test.xml","sample.tar.gz", 'w:gz') File "/usr/lib64/python2.4/tarfile.py", line 929, in open raise ValueError, "undiscernible mode" ValueEr

RE: creating a tar file with python

2007-08-23 Thread Brian McCann
Hi, I tried Steve's solution but get this error using the tar script below --Brian tar = tarfile.open(".","test.tar.gz",w:gz) [EMAIL PROTECTED] tmp]$ ./tarup.py File "./tarup.py", line 24 tar = tarfile.open(".","test.tar.gz",w:gz) ^ SyntaxError:

Problem from complex string messing up

2007-08-23 Thread sebzzz
Hi, I have these bunch of html files from which I've stripped presentation with BeautifulSoup (only kept a content div with the bare content). I've received a php template for the new site from the company we work with so I went on taking the same part of my first script that iterates through a g

Re: introspection and functions

2007-08-23 Thread Wildemar Wildenburger
Ricardo Aráoz wrote: > Ayaz Ahmed Khan wrote: > >> "James Stroud" typed: >> >>> py> def doit(a, b, c, x=14): >>> ... pass >>> ... >>> py> doit.func_code.co_argcount >>> 4 >>> py> doit.func_code.co_varnames >>> ('a', 'b', 'c', 'x') >>> py> doit.func_defaults >>> (14,) >>> >> Neat. >

Re: Co-developers wanted: document markup language

2007-08-23 Thread Aahz
In article <[EMAIL PROTECTED]>, Torsten Bronger <[EMAIL PROTECTED]> wrote: >Aahz writes: >> In article <[EMAIL PROTECTED]>, >> Torsten Bronger <[EMAIL PROTECTED]> wrote: >>> >>> Some LaTeX users in Aachen thought about a general-use markup >>> language this spring. I wrote some code and a rough

Re: Xah's Edu Corner: Under the spell of Leibniz's dream

2007-08-23 Thread Twisted
On Aug 23, 3:38 am, Matthias Buelow <[EMAIL PROTECTED]> wrote: > In comp.lang.lisp Bikal KC <[EMAIL PROTECTED]> wrote: > > > I used usenet years ago then stopped for couple of years. I remember > > seeing him/her on c.l.perl I believe doing the same thing he/she is > > doing atm. I'd say the ultima

Re: Co-developers wanted: document markup language

2007-08-23 Thread Torsten Bronger
Hallöchen! Aahz writes: > In article <[EMAIL PROTECTED]>, > Torsten Bronger <[EMAIL PROTECTED]> wrote: > >> Some LaTeX users in Aachen thought about a general-use markup >> language this spring. I wrote some code and a rough project >> description, however, we could need some help. > > http://d

Re: IDE for Python

2007-08-23 Thread Ricardo Aráoz
I V wrote: > On Tue, 21 Aug 2007 21:23:25 -0300, Ricardo Aráoz wrote: >> Do you know if for in-house development a GPL license applies? (Qt4 >> and/or Eric4). > > (I'm not sure if I've understood your question right) > > If you distribute an app that _uses_ PyQT, you have to comply with the

Re: introspection and functions

2007-08-23 Thread Ricardo Aráoz
Ayaz Ahmed Khan wrote: > "James Stroud" typed: >> py> def doit(a, b, c, x=14): >> ... pass >> ... >> py> doit.func_code.co_argcount >> 4 >> py> doit.func_code.co_varnames >> ('a', 'b', 'c', 'x') >> py> doit.func_defaults >> (14,) > > Neat. > How do you know the 14 corresponds to x ? -- http

Re: comparing two lists

2007-08-23 Thread Ladislav Andel
Peter Otten wrote: > Ladislav Andel wrote: > > >> Peter Otten wrote: >> >>> Ladislav Andel wrote: >>> >>> >>> what would be the most efficient way to do following? I have a list of dictionaries taken from DB e.g. dblist = [{'id:1, 'host':'google.com','ip_addre

Re: Impersonate another user temporarily (Unix and Windows)

2007-08-23 Thread billiejoex
On 23 Ago, 23:20, Steve Holden <[EMAIL PROTECTED]> wrote: > billiejoex wrote: > > On 23 Ago, 13:13, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > [...] > >> Note that running your process as a user with enough priviledges to > >> impersonate another user pretty much eliminates all the benefits of > >

Re: comparing two lists

2007-08-23 Thread Peter Otten
Ladislav Andel wrote: > Peter Otten wrote: >> Ladislav Andel wrote: >> >> >>> what would be the most efficient way to do following? >>> >>> I have a list of dictionaries taken from DB e.g. >>> dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'}, >>> {'id:3, 'host':'yahoo.com','ip_add

Final SF Python Patch/Bug Summary

2007-08-23 Thread Kurt B. Kaiser
New / Reopened Patches __ minidom pretty xml output improvement (2007-08-19) http://python.org/sf/1777134 opened by Teajay removeTest() method patch for unittest.TestSuite (2007-08-21) http://python.org/sf/1778410 opened by Mark Edgington robotparser.py fi

Re: comparing two lists

2007-08-23 Thread Ladislav Andel
Well, I know it's quite ugly what I did to the code, but any improvements are welcome. Actually, it doesn't work as it should yet. The items should stay the same as at the beginning. I say in one sentence what I want to achieve: Synchronized items with dblist. It should remove hosts from items whi

Re: creating a tar file with python

2007-08-23 Thread Steve Holden
Brian McCann wrote: > Hi, > > I'm trying to create a tar file of the contents of the current directory > > right now there is only one file "text.xml" in the current dir, I'm > using"." current dir as source > but that gives syntax error > > any help would be greatly appreciated > --Brian >

Re: Putting #'s and variables together in 1 variable

2007-08-23 Thread Steve Holden
Lamonte Harris wrote: > File "Desktop\python\newsystem\init.py", line 51, in random_n > random_name = a+b+c+d+e+ 'temp.txt' > TypeError: unsupported operand type(s) for +: 'int' and 'str' > > import random > def random_name(): > a = random.randint(0,9) > b = random.randint(0,9) >

Re: Impersonate another user temporarily (Unix and Windows)

2007-08-23 Thread Steve Holden
billiejoex wrote: > On 23 Ago, 13:13, "Chris Mellon" <[EMAIL PROTECTED]> wrote: [...] >> Note that running your process as a user with enough priviledges to >> impersonate another user pretty much eliminates all the benefits of >> running as a low-priviledged user in the first place. Consider >> re

Re: Redo: Problem with dynamic creation of classes.

2007-08-23 Thread Marc 'BlackJack' Rintsch
On Thu, 23 Aug 2007 16:55:21 -0400, Steven W. Orr wrote: > So it looks like the IFRAMED2 class which inherits from D2 is starting out > with the same id value for Encode as SNRMD which inherits from D, even > though D2 defines its own Encode method. > > Is it me of is it the interpreter doing som

Re: How would I compile a Python file to a exe

2007-08-23 Thread Charlie
Quoting Lamonte Harris <[EMAIL PROTECTED]>: > Been a while and I'm wondering how I would go about doing it. > py2exe seems to be a fairly good option for this, at least in the world of Windows. -- http://mail.python.org/mailman/listinfo/python-list

Re: How would I go about making a file open. Not the way you might think.

2007-08-23 Thread Lamonte Harris
I've completed this request and I got the answer already. On 8/23/07, Larry Bates <[EMAIL PROTECTED]> wrote: > > Hendrik van Rooyen wrote: > > Lamonte Harris wrote: > > > >> Basically you can open a file by double clicking, and by default it > would open > > w/ what every program you have it set

Redo: Problem with dynamic creation of classes.

2007-08-23 Thread Steven W. Orr
Sorry, I had a small description problem. It's corrected below. I have a base class B and a derived class D which inherits from B. I also have a D2 class which inherits from D. D is used as a base class for most of my generated classes. I have a "special" class which inherits from D2 because I nee

How would I compile a Python file to a exe

2007-08-23 Thread Lamonte Harris
Been a while and I'm wondering how I would go about doing it. -- http://mail.python.org/mailman/listinfo/python-list

Re: How would I go about making a file open. Not the way you might think.

2007-08-23 Thread kyosohma
On Aug 23, 3:45 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Hendrik van Rooyen wrote: > > Lamonte Harris wrote: > > >> Basically you can open a file by double clicking, and by default it would > >> open > > w/ what every program you have it set >to. Most text files would open in > > notepad. H

Re: Co-developers wanted: document markup language

2007-08-23 Thread Aahz
In article <[EMAIL PROTECTED]>, Torsten Bronger <[EMAIL PROTECTED]> wrote: > >Some LaTeX users in Aachen thought about a general-use markup >language this spring. I wrote some code and a rough project >description, however, we could need some help. http://docutils.sourceforge.net/ -- Aahz ([EMA

Re: simple spider in python

2007-08-23 Thread gmcalendar
> As to the Google API key issue, I was unaware of that. Very annoying > of them to stop that service. PyGoogle will basically be useless. well, i think that they deserve people moving toward yahoo's API... check this out: http://pysearch.sourceforge.net/ it's basically the same thing as pygoogle

Re: Problems with threading in embedded Python

2007-08-23 Thread Aahz
In article <[EMAIL PROTECTED]>, Nico Blodow <[EMAIL PROTECTED]> wrote: > >I hope this hasn't been brought up before, but if it did i missed it, >so bear with me please :) anyway, i'm trying to embed Python into a C >program. A sample python syript i want to run is as follows: Looks like nobody he

Re: How would I go about making a file open. Not the way you might think.

2007-08-23 Thread Larry Bates
Hendrik van Rooyen wrote: > Lamonte Harris wrote: > >> Basically you can open a file by double clicking, and by default it would >> open > w/ what every program you have it set >to. Most text files would open in > notepad. How can I make a txt open so that notepad opens w/ the content in it >

Re: simple spider in python

2007-08-23 Thread Michael Bentley
On Aug 23, 2007, at 6:33 AM, [EMAIL PROTECTED] wrote: > Hi everybody, i'm new to the forum so: hello everybody (should I say > "world"?) ^_^ > I'm trying to do a simple spider in python which: > > 1) ask google a query > 2) parse the data > > I'm a python newbie so *any* help would be very, very

Problem with dynamic creation of classes.

2007-08-23 Thread Steven W. Orr
I have a base class B and a derived class D which inherits from B. I also have a D2 class which inherits from D. D is used as a base class for most of my generated classes. I have a "special" class which inherits from D2 because I need to override a couple of its methods. Anything based on D2 w

Re: MsiLib

2007-08-23 Thread Charlie
Quoting "Martin v. Löwis" <[EMAIL PROTECTED]>: > Charlie schrieb: >> Thank you everybody for your help. It finally runs without errors and I >> should be able to use this as I figure out more of it. I am curios if >> there is any idea as to when GetString will be implemented? > > If I can find the

Re: Syslog

2007-08-23 Thread Michael Bentley
On Aug 20, 2007, at 4:56 PM, greg wrote: > Hi All, > > Could anyone tell me how I could syslog to a specific log (e.g. /var/ > log/daemon.log, /var/log/syslog.log...)? > # something like this: import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(lev

Re: Putting #'s and variables together in 1 variable

2007-08-23 Thread Grant Edwards
On 2007-08-23, Jay Loden <[EMAIL PROTECTED]> wrote: > 2) Since all you're doing is adding a bunch of numeric values to each other >to build the string, why wouldn't you just create a random number between >0 -> 9 and use that? Since the OP calls randint 5 times, his answer is 5 times

Re: Putting #'s and variables together in 1 variable

2007-08-23 Thread Jay Loden
Lamonte Harris wrote: > File "Desktop\python\newsystem\init.py", line 51, in random_n > random_name = a+b+c+d+e+ 'temp.txt' > TypeError: unsupported operand type(s) for +: 'int' and 'str' > > import random > def random_name(): > a = random.randint(0,9) > b = random.randint(0,9) >

Re: Using Regular Expresions to change .htm to .php in files

2007-08-23 Thread Tim Williams
On 23/08/07, Tim Williams <[EMAIL PROTECTED]> wrote: > On 23/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I have a bunch of files that have changed from standard htm files to > > php files but all the links inside the site are now broken because > > they point to the .htm fil

Re: Newbie: List file system roots

2007-08-23 Thread kyosohma
On Aug 23, 2:48 pm, "Einar W. Høst" <[EMAIL PROTECTED]> wrote: > Hi, > > How would you list the file system roots in Python? That is, I'm looking > for a way to list all connected drives (C:, D: etc) on a Windows box, or > all /root, /tmp etc on a *nix box. In Java, there's a built-in API > functio

Putting #'s and variables together in 1 variable

2007-08-23 Thread Lamonte Harris
File "Desktop\python\newsystem\init.py", line 51, in random_n random_name = a+b+c+d+e+ 'temp.txt' TypeError: unsupported operand type(s) for +: 'int' and 'str' import random def random_name(): a = random.randint(0,9) b = random.randint(0,9) c = random.randint(0,9) d = random.

Re: Using Regular Expresions to change .htm to .php in files

2007-08-23 Thread Tim Williams
On 23/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I have a bunch of files that have changed from standard htm files to > php files but all the links inside the site are now broken because > they point to the .htm files while they are now .php files. > > Does anyone have an idea ab

Re: MsiLib

2007-08-23 Thread Martin v. Löwis
Charlie schrieb: > Thank you everybody for your help. It finally runs without errors and I > should be able to use this as I figure out more of it. I am curios if > there is any idea as to when GetString will be implemented? If I can find the time, it may be for Python 2.6. If not, Python 2.7, 3.1

Re: libgmail failure

2007-08-23 Thread [EMAIL PROTECTED]
Thanks! That worked brilliantly. -James -- http://mail.python.org/mailman/listinfo/python-list

Newbie: List file system roots

2007-08-23 Thread Einar W. Høst
Hi, How would you list the file system roots in Python? That is, I'm looking for a way to list all connected drives (C:, D: etc) on a Windows box, or all /root, /tmp etc on a *nix box. In Java, there's a built-in API function to do this, File.listRoots(), but I couldn't find any equivalents in the

Re: beginner, idiomatic python

2007-08-23 Thread Zentrader
Does page count change? i.e. is it necessary to retrieve it in every loop or tempList = ['1','2','3','4','5','6','7','8'] sampleList=[] page_count = self.parent.GetPageCount() for i in range(page_count): Also, once pagefound is set to True, all pages following will not be appended to sampleL

Re: Question about embedding python in C++

2007-08-23 Thread TheShadow
On Aug 23, 1:17 pm, TheShadow <[EMAIL PROTECTED]> wrote: > On Aug 23, 11:57 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > > > TheShadow wrote: > > > When extending python in c/c++ after you register a module is there a > > > way in c/c++ to check if they were correctly registered? > > > > Cause

Using Regular Expresions to change .htm to .php in files

2007-08-23 Thread sebzzz
Hi, I have a bunch of files that have changed from standard htm files to php files but all the links inside the site are now broken because they point to the .htm files while they are now .php files. Does anyone have an idea about how to do a simple script that changes each .htm in a given file t

Re: advice about `correct' use of decorator

2007-08-23 Thread Gerardo Herzig
BJörn Lindqvist wrote: >On 8/22/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > >>On 22 ago, 10:00, "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: >> >> >>>As I said, you can accomplish the exact same thing by calling a >>>function from within the function that requires the user to be log

Re: how to select between two file libraries with same name?

2007-08-23 Thread kyosohma
On Aug 23, 1:46 pm, jmborr <[EMAIL PROTECTED]> wrote: > Imagine my file one.py contains the statement > import two > If there's a two.py in same directory as one.py, then this file will > be loaded. However, I want to load a different file named also two.py, > say file ~username/mypythonlib/two.py

Re: Question about embedding python in C++

2007-08-23 Thread TheShadow
On Aug 23, 11:57 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > TheShadow wrote: > > When extending python in c/c++ after you register a module is there a > > way in c/c++ to check if they were correctly registered? > > > Cause I'm having the problem where when I execute the the python > > scrip

Re: Impersonate another user temporarily (Unix and Windows)

2007-08-23 Thread billiejoex
On 23 Ago, 13:13, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 8/23/07, billiejoex <[EMAIL PROTECTED]> wrote: > > > > > > > On 23 Ago, 10:38, Tim Golden <[EMAIL PROTECTED]> wrote: > > > billiejoex wrote: > > > > Hi there. I'm writing a modification for a FTP server library I'm > > > > maintaining

python setup.py: how to override a setup.cfg value ?

2007-08-23 Thread Chris Shenton
I'm building python-ldap and need to change values of library and include paths that are in the setup.cfg file. This is an automated build (using "buildit") so I'd prefer not to have edit the .cfg by hand, with sed, or even with buildit's Substitute(). I'd like to be able to do something like I'd

how to select between two file libraries with same name?

2007-08-23 Thread jmborr
Imagine my file one.py contains the statement import two If there's a two.py in same directory as one.py, then this file will be loaded. However, I want to load a different file named also two.py, say file ~username/mypythonlib/two.py How can I select between the two two.py files ? -jose -- http:

how to select between two file libraries with same name?

2007-08-23 Thread Jose Borreguero
Imagine my file one.py contains the statement import two If there's a two.py in same directory as one.py, then this file will be loaded. However, I want to load a different file named also two.py, say file ~username/mypythonlib/two.py How can I select between the two two.py files ? -jose -- http:

Re: Question about embedding python in C++

2007-08-23 Thread TheShadow
On Aug 23, 11:57 am, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > TheShadow wrote: > > When extending python in c/c++ after you register a module is there a > > way in c/c++ to check if they were correctly registered? > > > Cause I'm having the problem where when I execute the the python > > scrip

Issue tracker migration is complete

2007-08-23 Thread Brett Cannon
Thanks to the work of Erik Forsberg and Martin von Löwis, Python's issue tracker now lives at http://bugs.python.org . Because this is a new tracker on a new system you cannot use your SourceForge password on the new tracker. But account names have been migrated, so if you go to "Lost your login?

Re: comparing two lists

2007-08-23 Thread Ladislav Andel
Peter Otten wrote: > Ladislav Andel wrote: > > >> what would be the most efficient way to do following? >> >> I have a list of dictionaries taken from DB e.g. >> dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'}, >> {'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'}, >> {'id:9, 'hos

Re: ctypes and unsigned char*

2007-08-23 Thread [EMAIL PROTECTED]
On 23 Aug., 05:46, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > If the result can contain nul bytes, you have to specify its size > explicitely (else it will be truncated at the first zero). Use the > string_at utility function: > > result_str = string_at(result, length) > > (That should work f

Re: Question about embedding python in C++

2007-08-23 Thread Farshid Lashkari
TheShadow wrote: > When extending python in c/c++ after you register a module is there a > way in c/c++ to check if they were correctly registered? > > Cause I'm having the problem where when I execute the the python > script it finds the module but none of the functions. > Are you calling Py_In

Re: Socket recv(1) seems to block instead of returning end of file.

2007-08-23 Thread Grant Edwards
On 2007-08-23, Dan Stromberg - Datallegro <[EMAIL PROTECTED]> wrote: > On Thu, 23 Aug 2007 11:54:01 +0200, Hendrik van Rooyen wrote: > >> >> While doing a netstring implementation I noticed that if you >> build a record up using socket's recv(1), then when you close >> the remote end down, the rec

Re: Socket recv(1) seems to block instead of returning end of file.

2007-08-23 Thread Grant Edwards
On 2007-08-23, Dan Stromberg - Datallegro <[EMAIL PROTECTED]> wrote: > Are you using sock.settimeout()? Hey, somebody snuck timeouts into the socket module when I wasn't looking... > I agree with Grant though - posting a minimal snippet of code that > replicates the problem would help us help yo

Question about embedding python in C++

2007-08-23 Thread TheShadow
When extending python in c/c++ after you register a module is there a way in c/c++ to check if they were correctly registered? Cause I'm having the problem where when I execute the the python script it finds the module but none of the functions. -- http://mail.python.org/mailman/listinfo/python-

Re: comparing two lists

2007-08-23 Thread Peter Otten
Ladislav Andel wrote: > what would be the most efficient way to do following? > > I have a list of dictionaries taken from DB e.g. > dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'}, > {'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'}, > {'id:9, 'host':'msn.com','ip_address':'11.3.

Re: comparing two lists

2007-08-23 Thread Erik Jones
On Aug 23, 2007, at 11:27 AM, Ladislav Andel wrote: > Hi, > what would be the most efficient way to do following? > > I have a list of dictionaries taken from DB e.g. > dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'}, > {'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'}, > {'id:9, '

Re: Simple Python Spider

2007-08-23 Thread Thomas Wittek
luca bertini schrieb: > 1) ask google a query http://code.google.com/apis/ http://code.google.com/apis/ajaxsearch/ But you probably have to reverse engineer the JavaScript lib. > 2) parse the data http://blog.hill-street.net/?p=7 -- Thomas Wittek Web: http://gedankenkonstrukt.de/ Jabber: [EMAI

Re: simple spider in python

2007-08-23 Thread samushack
> Somewhere in the middle between the two suggestions you've already > received is http://www.unixreview.com/documents/s=10133/ur0706e/>. I followed that link, and got an error page... As to the Google API key issue, I was unaware of that. Very annoying of them to stop that service. PyGoogle will

Re: My 'time' module is broken, unsure of cause

2007-08-23 Thread Gary Herron
darren kirby wrote: > Hi all, > > I have a strange error here and I am unsure how to further investigate it: > > Python 2.4.4 (#1, Aug 23 2007, 10:51:29) > [GCC 4.1.2 (Gentoo 4.1.2)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > import time

Re: My 'time' module is broken, unsure of cause

2007-08-23 Thread darren kirby
quoth the Calderone: > > [EMAIL PROTECTED]:~$ echo "print '40:42:0'" > time.py > [EMAIL PROTECTED]:~$ python > Python 2.4.3 (#2, Oct 6 2006, 07:52:30) > [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >

  1   2   >