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: 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

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: 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: 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: 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: 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

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

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

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

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: 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: 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: 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: 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: 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

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 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

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 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: 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: 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: 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: 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 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: 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. >

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: 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:

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

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: 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

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

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.

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 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) >

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: 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 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

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: 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: 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: 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: 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: 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: 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

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: 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 >

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: 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: 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

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: 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?

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: 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
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 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: 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: 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 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

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: 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

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

<    1   2