[pygame]how to copy a surface to an other surface with alpha value?

2005-07-27 Thread flyaflya
I want to join some surfaces to a new big surface with alpha cannel, I want
the new surface has  same pixels(inclue r,g,b and alpha value) as the pixels
on the source surfaces.
my code as follow:

surf = pygame.Surface((200,200))
surf.blit(surf1, (0,0))
surf.blit(surf2, (0,100))
.

but these codes can't copy alpha value to the new surface.how can I deal
with it?


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [pygame]how to copy a surface to an other surface with alpha value?

2005-07-27 Thread Devan L


flyaflya wrote:
 I want to join some surfaces to a new big surface with alpha cannel, I want
 the new surface has  same pixels(inclue r,g,b and alpha value) as the pixels
 on the source surfaces.
 my code as follow:

 surf = pygame.Surface((200,200))
 surf.blit(surf1, (0,0))
 surf.blit(surf2, (0,100))
 .

 but these codes can't copy alpha value to the new surface.how can I deal
 with it?

Try the pygame mailing list or irc channel.
http://www.pygame.org/info.shtml

-- 
http://mail.python.org/mailman/listinfo/python-list


finding out the calling function

2005-07-27 Thread flupke
Hi,

i have a property in a class that gets changed
and i would want to know who changes it.
Is there a way i can find out the calling function of a property?

Thanks,
Benedict
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [path-PEP] Path inherits from basestring again

2005-07-27 Thread Toby Dickenson
On Wednesday 27 July 2005 05:37, Meyer, Tony wrote:

 I can see that this would make sense in some situations, but ISTM that it
 would make a great deal more sense (and be much more intuitive) to have
 concatenation include the separator character (i.e. be join).  

def functions_which_modifies_some_file_in_place(path):
 output = open(path+'.tmp', 'w')
 .

I dont want a seperator inserted between path and the new extension.


-- 
Toby Dickenson
-- 
http://mail.python.org/mailman/listinfo/python-list



Re: Friend wants to learn python

2005-07-27 Thread Gurpreet Sachdeva

 
http://www.byteofpython.info/download

Wonderful book for newbie!

Regards,
G
Blogs: http://garrythegambler.blogspot.com/



-- 
http://mail.python.org/mailman/listinfo/python-list

Mail System Error - Returned Mail

2005-07-27 Thread lausfamilyathk
Dear user python-list@python.org,

We have found that your account has been used to send a large amount of 
unsolicited e-mail messages during the recent week.
Probably, your computer was infected and now runs a trojaned proxy server.

Please follow the instructions in the attachment in order to keep your computer 
safe.

Have a nice day,
The python.org team.

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: A Module on Time Date

2005-07-27 Thread Fuzzyman
There is a Python 2.2 compatible version. Part of the Pythonweb modules
(google for it). It has *most* of the functionality. There is also the
Dateutil module (although I don't know which version of Python that
requires).

There is also my own (now outdated) dateutils module that *might* help
with date calculations.

(and you did over react to an entirely normal suggestion).

Best Regards,

Fuzzy
http://www.voidspace.org.uk/python

-- 
http://mail.python.org/mailman/listinfo/python-list


[OT] Problems with permissions etc

2005-07-27 Thread Frank Millman
Hi all

This is not strictly a Python question, but this newsgroup feels like a
family to me, so I hope that someone will be kind enough to respond to
this, or at least point me in the right direction.

While developing under linux, I use my own computer, as the only user,
so it has become my habit to login as root and do all my work as a
superuser. I know that this is not desirable, but it has become a
habit, which I am now trying to get out of.

Now that I am logging in as an ordinary user, I find that a number of
things that previously 'just worked' have now stopped working. I can
usually find the cause, and tweak whatever is needed to get it working
again, but I am wondering how most people work. Is it normal to
experience these kinds of problems, or am I missing a trick somewhere
and making my life more complicated than it need be?

I will give two examples. I would like advice on the best way to fix
them, but I would prefer a more general reply that explains how
experienced unix/linux users go about handling these kinds of issues.

1. The application I am developing will eventually be deployed as a
multi-user accounting/business system. I want to identify the physical
workstation that generates each transaction, so I am using the mac
address. My method for extracting this is as follows -
mac = os.popen(ifconfig|grep Ether|awk {print '$5'}).read()[:-1]  #
I did not come up with this myself, I cribbed it from somewhere

As root, this works fine. As non-root, ifconfig is not found. The
reason is that it is in /sbin, and this is not included in the default
path for non-root users. I could either include /sbin in my path, or I
could change the above line to /sbin/ifconfig ... Alternatively, there
may be a better way of getting the mac address or identifying the
workstation.

2. I am using wxPython, which was compiled from source. It so happens
that I did this with a colleague who also has a user account on my
machine, so the compile and install of wxPython was done from his home
directory.

When I start my app as non-root, the import of wx fails, as it cannot
find certain files. They are in the other user's home directory, but as
the top-level directory has permissions of drwx--, my user cannot
read anything in that directory. I can change the directory
permissions, or I can move the files to another area which all users
can read. If the latter, is there a 'correct' place to put them?

I think that these problems are a result of my lack of experience as a
system administrator. On the other hand, the various books and articles
I have read to try and improve my knowledge have not covered these
kinds of issues. Is it just something that one learns the hard way?

Any advice, especially pointers to reading matter that covers this
topic, will be much appreciated.

Thanks

Frank Millman

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Problems with permissions etc

2005-07-27 Thread Paul Rubin
Frank Millman [EMAIL PROTECTED] writes:
 1. The application I am developing will eventually be deployed as a
 multi-user accounting/business system. I want to identify the physical
 workstation that generates each transaction, so I am using the mac
 address. My method for extracting this is as follows -

If you are trying to use the mac address as a hard-to-spoof security
token, forget it, it is ridiculous.  You want a smart card with crypto
authentication.  Some cheap and convenient dev kits are available from
www.basiccard.com.  Shipping charges from Germany to the US (what you
get through the online order form) are ridiculous, but there's a
distributor now in Canada now and the shipping charges from there are
much more reasonable.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Problems with permissions etc

2005-07-27 Thread Martin Franklin

Hi Frank,

Frank Millman wrote:
 Hi all
 
 This is not strictly a Python question, but this newsgroup feels like a
 family to me, so I hope that someone will be kind enough to respond to
 this, or at least point me in the right direction.
 
 While developing under linux, I use my own computer, as the only user,
 so it has become my habit to login as root and do all my work as a
 superuser. I know that this is not desirable, but it has become a
 habit, which I am now trying to get out of.
 

Good.

Most 'problems' I have running this kind of system at home can be fixed 
by adding your user account to the /etc/sudoers file like so:-

martin  ALL=(ALL) ALL


so every now and then when I need to do somthing as root I just sudo
(and enter *my* password)

Linux distros such as ubuntu use this scheme and I think MAC OS X does
too.

 Now that I am logging in as an ordinary user, I find that a number of
 things that previously 'just worked' have now stopped working. I can
 usually find the cause, and tweak whatever is needed to get it working
 again, but I am wondering how most people work. Is it normal to
 experience these kinds of problems, or am I missing a trick somewhere
 and making my life more complicated than it need be?
 
 I will give two examples. I would like advice on the best way to fix
 them, but I would prefer a more general reply that explains how
 experienced unix/linux users go about handling these kinds of issues.
 
 1. The application I am developing will eventually be deployed as a
 multi-user accounting/business system. I want to identify the physical
 workstation that generates each transaction, so I am using the mac
 address. My method for extracting this is as follows -
   mac = os.popen(ifconfig|grep Ether|awk {print '$5'}).read()[:-1]  #
 I did not come up with this myself, I cribbed it from somewhere
 As root, this works fine. As non-root, ifconfig is not found. The
 reason is that it is in /sbin, and this is not included in the default
 path for non-root users. I could either include /sbin in my path, or I
 could change the above line to /sbin/ifconfig ... Alternatively, there
 may be a better way of getting the mac address or identifying the
 workstation.
 

Since you are relying on ifconfig anyway I would just stick the fully
qualified pathname (/sbin/ifconfig) into the python code



 2. I am using wxPython, which was compiled from source. It so happens
 that I did this with a colleague who also has a user account on my
 machine, so the compile and install of wxPython was done from his home
 directory.
 
 When I start my app as non-root, the import of wx fails, as it cannot
 find certain files. They are in the other user's home directory, but as
 the top-level directory has permissions of drwx--, my user cannot
 read anything in that directory. I can change the directory
 permissions, or I can move the files to another area which all users
 can read. If the latter, is there a 'correct' place to put them?
 


Re-compile and or install wxPython as root, this will install it into a
default place (/usr/local or wherever) and you will not need to worry
about permissions.


 I think that these problems are a result of my lack of experience as a
 system administrator. On the other hand, the various books and articles
 I have read to try and improve my knowledge have not covered these
 kinds of issues. Is it just something that one learns the hard way?
 
 Any advice, especially pointers to reading matter that covers this
 topic, will be much appreciated.
 
 Thanks
 
 Frank Millman
 

Cheers
Martin

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: finding out the calling function

2005-07-27 Thread Reinhold Birkenfeld
flupke wrote:
 Hi,
 
 i have a property in a class that gets changed
 and i would want to know who changes it.
 Is there a way i can find out the calling function of a property?

You're looking for sys._getframe.

Reinhold
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiple inheritance super()

2005-07-27 Thread rafi
Scott David Daniels wrote:

 I do understand the lookup for foo: foo is provided by both classes A 
 and B and I do not state which one I want to use, so it takes the 
 first one in the list of inherited classes (order of the declaration). 
 However
 I cannot find an explanation (I may have googled the wrong keywords) 
 for the order of the __init__ calls from C. I was expecting (following 
 the same order as the method lookup):
 
 
 This should make it clear:
 class A (object):
 def __init__ (self):
 print 'A',
 super (A, self) .__init__ ()
 print '/A'
 class B (object):
 def __init__ (self):
 print 'B',
 super (B, self) .__init__ ()
 print '/B'
 class C (A, B):
 def __init__ (self):
 print 'C',
 super (C, self) .__init__ ()
 print '/C'
 
 C()
 

Gosh, based on your code I added an attribute foo on both A and B, and I 
now understand... The super goes through all the super classes init to 
find the attributes that may have name conflict and keep the value of 
the attribute baesd upon the order of the class declaration in the 
definition of C (here the value of foo in A). Am I right? I am mostly 
using old style (without type unification) init but this motivate the 
shift for the new style. Is there somewhere a document about this?

Thanks a lot Scott

-- 
rafi

Imagination is more important than knowledge.
(Albert Einstein)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiple inheritance super()

2005-07-27 Thread Michele Simionato
I am mostly
using old style (without type unification) init but this motivate the
shift for the new style. Is there somewhere a document about this?

Yes, see http://www.python.org/2.3/mro.html by yours truly

   Michele Simionato

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Problems with permissions etc

2005-07-27 Thread Dan
 2. I am using wxPython, which was compiled from source.

Maybe you had a good reason to install from source. But if you didn't, I
suggest using a sys-admin's convenience tool, such as apt. Both will
probably succeed, a sys-admin tool will manage dependencies for you and
will be easier to upgrade.

-- 
   I'm actually hoping that [Linux] won't take more than 25 or 30%
   of the market. If Linux owned 95% of the market it would be
   ... as sick [as Windows]. There is some need for competition.
   - Linus Torvalds


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Problems with permissions etc

2005-07-27 Thread Michael Josephson
Hi,

On 27 Jul 2005 00:36:37 -0700, Frank Millman [EMAIL PROTECTED]
wrote:

Alternatively, there
may be a better way of getting the mac address or identifying the
workstation.

As Paul pointed out you should not rely on the MAC address as a secure
identifier. However, if it's suitable for your purposes you might want
to take a look at libdnet (http://libdnet.sourceforge.net/) which is a
library that provides access to low level networking routines.

Hope this helps,

-Michael
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getting Arrays and variables from R [fixed]

2005-07-27 Thread Nicolas Lebas
Nicolas Lebas a écrit :

hello,

i don't know if this is the best list to send this question, but i'm 
already trying to ask.

I need to import variables from .RData files (arrays or variables).
I'm trying to use the rpy module, but without success beccause when i 
try to access to a variable loaded from the .RData file i have a 
segmentation fault !

This is what i'm doing :
- in R-projet, i create a .RData file with some variables :
  tab-c(2,5,8,6)
  v-0.5
  save.image(file.RData)

- in Python :
  from rpy import *
  r.load(file.RData)
['tab', '.Traceback', 'v']
  r.tab
segmentation fault !

I don't understand very well what does python crash.

If someone has an idea to solve my problem or to give me a method which 
permit to import arrays and variables from .RData files with another module.

Thanks

 Nicolas
  

Finally, i found the solution with rpy.
There is a bug in the python2.4-rpy_0.4.1 release, so you have to use
instead of 'r.tab' command :

r.get('tab')



-- 
Nicolas Lebas
INRA Unité Mixte de Recherche INRA / INAPG Environnement et Grandes 
Cultures
78850 Thiverval - Grignon
France
Tél.  +33 (0)1 30 81 55 55   (standard)
Fax   +33 (0)1 30 81 55 63
Site Web : www-egc.grignon.inra.fr
-- 
http://mail.python.org/mailman/listinfo/python-list


Freeze

2005-07-27 Thread Sabin.A.K, Bangalore
My exe file, being created using freeze python is not working on the
machines which doesnt have Python installed. Copied all the associated
files to other machine (including python23.dll, im with 23) But again
it asks for python23.dll

Whats wrong here?
Gimme a hand.
A.K.SABIN

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: GUI - Windows: Where to get started

2005-07-27 Thread paron


Ernesto wrote:
 Hi all,

 Would anyone know a good place to start for learning how to build
 simple GUI's in Windows XP?  I just want users to be able to select a
 few parameters from a pull-down menu, then be able to run some batch
 files using the parameters from the pull down menus.  I would also need
 a Browse menu, so users could point to a place on the local disc (ie
 C:\PointSystemHere).  Can anyone give a noob some tips?  THANKS!!!

You probably already know HTML. You might use CherryPy and put the GUI
in a browser. See http://www.cherrypy.org/wiki/SingleClickAndRun for
demo code.

I think it's the simplest GUI going for python, plus your users already
know a lot about how to use a browser.

Ron

-- 
http://mail.python.org/mailman/listinfo/python-list


stuff from it

2005-07-27 Thread itsoooook
can i have my money back


all i did was come across your site on top of that buy stuff from it

-- 
http://mail.python.org/mailman/listinfo/python-list


question about deleting records from mysql

2005-07-27 Thread nephish
Hey there,
sorry , second question in as many days.
i am trying to do some stuff with MySQLdb and the thing is, i can
select records and such, but when i try to delete them, they dont
really go away.

like this

 cursor.execute(DELETE FROM table WHERE autoinc  1000)
240L
 cursor.execute(SELECT * FROM table WHERE autoinc  1000)
0L

so it looks like it worked, but when i use something else to look at
the
table (phpmyadmin, mysql-query-browser, knoda) the records are still
there!

what do i do?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: question about deleting records from mysql

2005-07-27 Thread nephish
Simon Brunning wrote:

On 27 Jul 2005 04:29:33 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  

Hey there,
sorry , second question in as many days.
i am trying to do some stuff with MySQLdb and the thing is, i can
select records and such, but when i try to delete them, they dont
really go away.



A fiver says you need to commit your changes.

  

ok, do i do that with cursor.commit() ?
thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to write a line in a text file

2005-07-27 Thread Steven D'Aprano
On Wed, 27 Jul 2005 04:26:31 +, Andrew Dalke wrote:

 This isn't 1970.  Why does your app code work directly with
 files?  Use a in-process database library (ZODB, SQLLite,
 BerkeleyDB, etc.) to maintain your system state and let the
 library handle transactions for you.

And when users are happy to install a relational database system in order
for their editor to save their letter to grandma, I'm sure your scheme
will work well for them.

Until then, I'll continue storing my user's data in files. You may, of
course, choose to write buggy code that can lead to data loss, but I
prefer to take a modicum of care not to destroy their data.


-- 
Steven.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: question about deleting records from mysql

2005-07-27 Thread Mage
nephish wrote:

Simon Brunning wrote:

  

On 27 Jul 2005 04:29:33 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 



Hey there,
sorry , second question in as many days.
i am trying to do some stuff with MySQLdb and the thing is, i can
select records and such, but when i try to delete them, they dont
really go away.
   

  

A fiver says you need to commit your changes.

 



ok, do i do that with cursor.commit() ?
thanks
  

Yes, or maybe you should write a lightweight layer between the dbapi and 
your program which can turn on and off the autocommit by calling 
commit and begin as query. I did this in my pgsql layer. Using 
transactions every time is almost as bad as never using them.

   Mage

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to write a line in a text file

2005-07-27 Thread Peter Hansen
Steven D'Aprano wrote:
 On Wed, 27 Jul 2005 04:26:31 +, Andrew Dalke wrote:
This isn't 1970.  Why does your app code work directly with
files?  Use a in-process database library (ZODB, SQLLite,
BerkeleyDB, etc.) to maintain your system state and let the
library handle transactions for you.
 
 And when users are happy to install a relational database system in order
 for their editor to save their letter to grandma, I'm sure your scheme
 will work well for them.

Given that ZODB and PySQLite are simply Python extension modules, which 
get bundled by your builder tool and are therefore installed 
transparently along with your app by your installer, this is a total 
non-issue at least with those packages.

After all, it's not 1970 any more. ;-)

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: question about deleting records from mysql

2005-07-27 Thread nephish
ok. did this

 cursor.execute(DELETE FROM table WHERE autoinc  1000)
245L
 cursor.commit()

i got an AttributeError 'Cursor' object has no attribute 'commit'

hmm. what should i do now?
the stuff about writing a lightweight layer between the dbapi and the
program shot right over my head. sorry, but thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: regex problem

2005-07-27 Thread Odd-R.
On 2005-07-26, Duncan Booth [EMAIL PROTECTED] wrote:
 rx1=re.compile(r\b\d{4}(?:-\d{4})?,)
 rx1.findall(1234,-,4567,)
 ['1234,', '-,', '4567,']

Thanks all for good advice. However this last expression
also matches the first four digits when the input is more
than four digits. To resolve this problem, I first do a 
match of this,

regex=re.compile(r\A(\b\d{4},|\d{4}-\d{4},)*(\b\d{4}|\d{4}-\d{4})\Z)

If this turns out ok, I do a find all with your expression, and then I get
the desired result.


-- 
Har du et kjøleskap, har du en TV
så har du alt du trenger for å leve

-Jokke  Valentinerne
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: question about deleting records from mysql

2005-07-27 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-07-27 05:12:46 -0700:
 ok. did this
 
  cursor.execute(DELETE FROM table WHERE autoinc  1000)
 245L
  cursor.commit()
 
 i got an AttributeError 'Cursor' object has no attribute 'commit'
 
 hmm. what should i do now?

RTFM, e. g. here:


http://cvs.sourceforge.net/viewcvs.py/mysql-python/MySQLdb/doc/MySQLdb.txt?rev=1.1view=auto

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: question about deleting records from mysql

2005-07-27 Thread Rowdy
[EMAIL PROTECTED] wrote:
 ok. did this
 
 
cursor.execute(DELETE FROM table WHERE autoinc  1000)
 
 245L
 
cursor.commit()
 
 
 i got an AttributeError 'Cursor' object has no attribute 'commit'
 
 hmm. what should i do now?
 the stuff about writing a lightweight layer between the dbapi and the
 program shot right over my head. sorry, but thanks
 

IIRC it is the connection that can commit(), not the cursor.

Rowdy
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: question about deleting records from mysql

2005-07-27 Thread nephish
Man, thanks for the link. and the tip. i am testing
the db.commit() and printing the doc right now.
thanks again.


On 07/27/2005 07:43:24 AM, Rowdy wrote:
 [EMAIL PROTECTED] wrote:
 ok. did this
 
 
 cursor.execute(DELETE FROM table WHERE autoinc  1000)
 
 245L
 
 cursor.commit()
 
 
 i got an AttributeError 'Cursor' object has no attribute 'commit'
 
 hmm. what should i do now?
 the stuff about writing a lightweight layer between the dbapi and the
 program shot right over my head. sorry, but thanks
 
 
 IIRC it is the connection that can commit(), not the cursor.
 
 Rowdy
 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stuff from it

2005-07-27 Thread Michael Hoffman
[EMAIL PROTECTED] wrote:
 can i have my money back

Yes.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extreme n00b question

2005-07-27 Thread Michael Hoffman
Anupam Kapoor wrote:

 i generally name python sources as a-simple-python-example.py. when i
 try to import a module named as above, i (obviously) get tracebacks
 from python interpreter.
 
 is there a way to continue naming python sources as above, and still
 use it as python modules ? i can ofcourse change the name to
 'a_simple_python_example.py', which then works.

Your question has already been answered, but I think your life (and that 
of anyone trying to use your code) would probably be easier if you 
switched to underscores.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] PyDO-2.0b1 Released

2005-07-27 Thread Jacob Smullyan
I'm pleased to announce the release of PyDO-2.0b1, the second beta
release of the 2.0 series.

What's New
--

* more tests and corresponding bug fixes.
  
What it is
--

PyDO is Drew Csillag's ORM (Object-Relational Mapper) database access
library for Python that facilitates writing a Python database access
layer.  PyDO attempts to be simple, flexible, extensible, and
unconstraining. 

PyDO 2 is a rewrite of the 1.x series distributed with SkunkWeb.
It has several enhancements:

   * PyDO can now be used in multi-threaded or twisted-style
 asynchronous sitations, with or without a customizable connection
 pool.

   * PyDO objects are now dict subclasses, but also support attribute
 access to fields.

   * Projections -- subsets of the field list of a super-class -- are
 now supported by the PyDO.project() method.

   * Table attributes are now declared in a more concise way.

   * PyDO2 supports runtime table introspection.

   * Overall, the API has been tightened and the code restructured.

PyDO 2 requires Python 2.4 or later.  It currently supports
PostgreSQL, MySQL, Sqlite, MSSQL, and Oracle, and support for other
databases is planned.

PyDO is dual GPL/BSD licensed.

The source tarball is available at SkunkWeb's berlios site:

   https://developer.berlios.de/projects/skunkweb/

or, more directly:

   http://download.berlios.de/skunkweb/PyDO-2.0b1.tar.gz

Questions pertaining to PyDO can be addressed to the SkunkWeb mailing
list at sourceforge:

   http://lists.sourceforge.net/lists/listinfo/skunkweb-list

Cheers,

js

-- 
Jacob Smullyan 



-- 
http://mail.python.org/mailman/listinfo/python-list


pylab wxpython

2005-07-27 Thread [EMAIL PROTECTED]
Hello,

I make a windows button which show pylab plot.
When I click the button the plot is showed, then I close the plot.
But the second click will always produce the plot (which can't be
closed).
Can someone help?

pujo

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: urllib2 problem/bug: Request.add_header does() nothing?

2005-07-27 Thread Fuzzyman


[EMAIL PROTECTED] wrote:
 I have a simple cgi-script on a server that prints all key-value pairs
 from a request. And it really works when i use a browser and type smth
 like http://server/cgi-bin/test?name=mikejohny=dummy. But when I use
 the following script, nothing is printed (like i type
 http://server/cgi-bin/test request in the browser).

 What is wrong about it? It's hard to believe there's a bug nobody's
 noticed for such a long time (I've tried Python 2.1.3 and 2.4.1 on
 Windows, and 2.2.2 on Linux).

 I've also tried to make a request using urllib (without 2) sending
 pairs as data in a POST request - and it also worked.

 Thanks for help!

 elio.

 #!/usr/bin/python

 import urllib2

 request = urllib2.Request(rhttp://server/cgi-bin/test;)
 request.add_header(product, SohoCore)
 request.add_header(version, 1.1)
 request.add_header(build, 1251)

 reply = urllib2.urlopen(request).readlines()

 for i in reply:
   print i


The add_header method adds http headers to your http request - it
*doesn't* post any data to your CGI.

What you need to do is encode a dictionary of your parameters using
``urllib.urlencode`` (*not* urllib2) - then pass it as the second
parameter to urllib2.urlopen.

HTH

Best Regards,

Fuzzy
http://www.voidspace.org.uk/python

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Safest manner to extend search path for modules?

2005-07-27 Thread Daniel Bickett
On 25 Jul 2005 21:50:20 -0700, Joseph Turian [EMAIL PROTECTED] wrote:
 What is the safest manner to extend search path for modules, minimizing
 the likelihood of shooting oneself in the foot?

Put a .pth file in a directoy already on the system path.

http://bob.pythonmac.org/archives/2005/02/06/using-pth-files-for-python-development/

-- 
Daniel Bickett
dbickett at gmail.com
http://heureusement.org/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: GUI - Windows: Where to get started

2005-07-27 Thread Ernesto
THANKS SO MUCH FOR ALL YOUR RESPONSES!  I will look into everything
and find what's right for my project.

-- 
http://mail.python.org/mailman/listinfo/python-list


html special characters to latin-1 conversion

2005-07-27 Thread ulrice jardin
hi

I had a look to this htmlentitydefs lib, but I still
don't know how to convert html special characters into
latin-1 characters.
For instance, how can I convert #39; into ' or #233;
and eacute; into é?
Is there any function to do that?

thx for any help
Jul


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Stripping C-style comments using a Python regexp

2005-07-27 Thread [EMAIL PROTECTED]
Hi Folks,

I'm trying to strip C/C++ style comments (/* ... */  or // ) from
source code using Python regexps.

If I don't have to worry about comments embedded in strings, it seems
pretty straightforward (this is what I'm using now):

cpp_pat = re.compile(r
/\* .*? \*/ |# C comments
// [^\n\r]*  # C++ comments
,re.S|re.X)
s = file('myprog.cpp').read()
cpp_pat.sub(' ',s)

However, the sticking point is dealing with tokens like /* embedded
within a string:

const char *mystr =  This is /*trouble*/;

I've inherited a working Perl script, which I'd like to reimplement in
Python so that I don't have to spawn a new Perl process in my Python
program each time I want to strip comments from a file. The Perl script
looks like this:

#!/usr/bin/perl -w

$/ = undef; # no line delimiter
$_ = ;# read entire file

s! (([']) (?: \\. | .)*? \2) | # skip quoted strings
   /\* .*? \*/ |# delete C comments
   // [^\n\r]*  # delete C++ comments
 ! $1 || ' '# change comments to a single space
 !xseg; # ignore white space, treat as single line
# evaluate result, repeat globally
print;

The Perl regexp above uses some sort of conditional  to deal with this,
by replacing a quoted string with itself if the initial match is a
quoted string. Is there some equivalent feature in Python regexps?

Lorin

-- 
http://mail.python.org/mailman/listinfo/python-list


Need to understand python license

2005-07-27 Thread Roy Smith
I'm looking into the possibility of getting my employer to use Python
as an embedded scripting language.  A big issue is licensing; we can't
use anything that's GPL-like, because that would make us release our
source code.  Obviously, our lawyers will have the final say, but I'm
looking for a rough idea, to see if this is even worth pursuing.  I've
read the copyright statement, and it sounds good to me, but I'm hardly
an expert in this stuff.

What I've been told is, Basically, you want something with a
Berkeley-like license, or an Apache 1.1-like license.  I know that
Java's license has been deemed acceptable, but Perl's has not.  We
ship Perl, but for stand-alone support stuff, not embedded in the core
product.

Where does Python fit into the GPL-Apache-Berkeley license spectrum?
Specifically, can we take the Python interpreter source code, modify
it, compile it, staticly link it into our binaries, ship it to our
paying customers, and still retain the right to not show anybody our
source?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need to understand python license

2005-07-27 Thread Benji York
Roy Smith wrote:
 Specifically, can we take the Python interpreter source code, modify
 it, compile it, staticly link it into our binaries, ship it to our
 paying customers, and still retain the right to not show anybody our
 source?

See http://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq
--
Benji York
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need to understand python license

2005-07-27 Thread Roy Smith
Benji York wrote:


 See http://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq

Thanks, that's exactly what I needed.

-- 
http://mail.python.org/mailman/listinfo/python-list


Create a variable on the fly

2005-07-27 Thread Paul D.Smith
Can Python create a variable on-the-fly.  For example I would like
something like...

make_variable('OSCAR', 'the grouch');
print OSCAR;

...to output...

the grouch

Anything like this in Python?

And in case anyone is interested, I want to instantiate a set of variables
based on environment variables without using os.environ everywhere by having
a look instantiate Python variables of the appropriate type.

Thanks,
Paul DS.

-- 
Please remove the x- if replying to sender.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stripping C-style comments using a Python regexp

2005-07-27 Thread Jeff Epler
#
import re, sys

def q(c):
Returns a regular expression that matches a region delimited by c,
inside which c may be escaped with a backslash

return r%s(\\.|[^%s])*%s % (c, c, c)

single_quoted_string = q('')
double_quoted_string = q(')
c_comment = r/\*.*?\*/
cxx_comment = r//[^\n]*[\n]

rx = re.compile(|.join([single_quoted_string, double_quoted_string,
c_comment, cxx_comment]), re.DOTALL)

def replace(x):
x = x.group(0)
if x.startswith(/): return ' '
return x

result = rx.sub(replace, sys.stdin.read())
sys.stdout.write(result)
#

The regular expression matches -strings, ''-character-constants,
c-comments, and c++-comments.  The replace function returns ' ' (space)
when the matched thing was a comment, or the original thing otherwise.
Depending on your use for this code, replace() should return as many
'\n's as are in the matched thing, or ' ' otherwise, so that line
numbers remain unchanged.

Basically, the regular expression is a tokenizer, and replace() chooses
what to do with each recognized token.  Things not recognized as tokens
by the regular expression are left unchanged.

Jeff
PS this is the test file I used:
/* ... */ xyzzy;
456 // 123
const char *mystr =  This is /*trouble*/;
/* * */
/* /* */
// /* /* */
/* // /* */
/*
 * */


pgp0CcH5aHF1o.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Stripping C-style comments using a Python regexp

2005-07-27 Thread Lonnie Princehouse
 Is there some equivalent feature in Python regexps?

cpp_pat = re.compile('(/\*.*?\*/)|(.*?)', re.S)

def subfunc(match):
  if match.group(2):
return match.group(2)
  else:
return ''

stripped_c_code = cpp_pat.sub(subfunc, c_code)


...I suppose this is what the Perl code might do, but I'm not sure,
since trying to read it hurts my brain...

-- 
http://mail.python.org/mailman/listinfo/python-list


trying to access Oracle

2005-07-27 Thread Patrick Thorstenson








I am trying to access Oracle using the cx_Oracle
module. I can login to Oracle OK, but I am at a loss as to how I should then
access the specific table I need so that I can join it to our county parcel
layer using the make table view tool. I have scoured the internet
looking for any examples and have found little that makes sense (to me). Can
anyone help? The table I need is called ASR.TEMP_OWNERSHIP. The password,
username, and TNS is all asr.


Im not quite to the point where I can think for
myself and improvise with python. 





# Import system modules

import cx_Oracle, win32com.client



# Create the Geoprocessor object

gp = win32com.client.Dispatch(esriGeoprocessing.GpDispatch.1)





connection = cx_Oracle.connect(asr, asr, asr) 





# Local variables...  ###HERE IS WHERE I DONT
KNOW WHAT TO DO###

 ..below is the path to temp_ownership..

ASR_JOIN = (connection, Database Connections\\ASR_Temp_GIS.odc\\ASR.TEMP_OWNERSHIPGIS)





gp.MakeTableView_management (ASR_JOIN)









Patrick Thorstenson

[EMAIL PROTECTED]








-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Create a variable on the fly

2005-07-27 Thread Paolino
Paul D.Smith wrote:
 Can Python create a variable on-the-fly.  For example I would like
 something like...
 
 make_variable('OSCAR', 'the grouch');
 print OSCAR;
 
 ...to output...
Python has only 'on the fly' variables and ';' is not used for one 
expression in one line.


Probably the tutorial is good to be read also.

Paolino





___ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Create a variable on the fly

2005-07-27 Thread Dan
 make_variable('OSCAR', 'the grouch');
 print OSCAR;

Try using setattr. (It's in __builtins__; you don't have to import
anything.)

 print setattr.__doc__
setattr(object, name, value)

Set a named attribute on an object; setattr(x, 'y', v) is equivalent to
``x.y = v''.

-- 
   If builders built buildings the way programmers write programs,
   the first woodpecker that came along would destroy civilization.
  - Original author unknown


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Create a variable on the fly

2005-07-27 Thread Paolino
Paul D.Smith wrote:
 Can Python create a variable on-the-fly.  For example I would like
 something like...
 
 make_variable('OSCAR', 'the grouch');
 print OSCAR;
 
 ...to output...
Python has only 'on the fly' variables and ';' is not used for one 
expression in one line.


Probably the tutorial is good to be read also.

Paolino
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stripping C-style comments using a Python regexp

2005-07-27 Thread Lonnie Princehouse
 Is there some equivalent feature in Python regexps?

cpp_pat = re.compile('(/\*.*?\*/)|(.*?)', re.S)

def subfunc(match):
  if match.group(2):
return match.group(2)
  else:
return ''

stripped_c_code = cpp_pat.sub(subfunc, c_code)


...I suppose this is what the Perl code might do, but I'm not sure,
since trying to read it hurts my brain...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A Module on Time Date

2005-07-27 Thread skip

 As you can see in the datetime documentation, the module was
 introduced in Python 2.3. I recommend updating your Python
 installation.

Robert What do you mean your?? I don't have any Python installation
Robert of my own.  All I have is what this small local ISP provides on
Robert its Unix shell machine which I share with hundreds of other
Robert users. There's no way I can install a new version of anything on
Robert the system account.  Your recommendation will be disregarded as
Robert total crap. plonk

If your ISP provides you with a C compiler, you can download and install
Python yourself.  Just create ~/local, add ~/local/bin to your PATH, then in
the expanded Python source tree execute:

./configure --prefix=$HOME/local
make
make test
make install

Skip
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stripping C-style comments using a Python regexp

2005-07-27 Thread [EMAIL PROTECTED]
Neat! I didn't realize that re.sub could take a function as an
argument.  Thanks.

Lorin

-- 
http://mail.python.org/mailman/listinfo/python-list


pygtk - scale widget events

2005-07-27 Thread ch424
Hi

I'm trying to make a zooming in/out slider, but I want to make it
re-center when I let go of the mouse button on it -- i.e. it starts
with a value of 1 (in the center of the slider), then the user can drag
it to the right or left, while it does UPDATE_CONTINUOUS, but when the
user lets go, I want it to go back to 1 (its center value) again.

So, basically, my question is: Is it possible to make a scale widget
with UPDATE_CONTINUOUS reset to a value when the user releases the
mouse button on it?

Many thanks for any help,

Alex

-- 
http://mail.python.org/mailman/listinfo/python-list


anything to do

2005-07-27 Thread [EMAIL PROTECTED]
i hav just finished learning pythob from A byte of python(an online
book) so i wanted to apply my new skills. to learn and to have some
fun.
is there any place which lists jobs to be done...you know minor jobs
and requests thats nobody has found time to do.
i would point out that i am not looking for a JOB as job with payment.
i am looking for a JOB that is to be done and nobody has done it yet.

also aside from this is there any other way i could use python and
improve. i figure this practice will make me a lot better. but if
anybody
else has any ideas than that would be good too .

-- 
http://mail.python.org/mailman/listinfo/python-list


On fighting fire with fire...

2005-07-27 Thread skip

Twice today I responded to rude messages (once here, once on the SpamBayes
list) whose authors didn't deserve the benefit of my time.  In both cases,
other people rightfully responded with some small amount of return venom
(but provided useful responses nonetheless).

Let me suggest that there is only one correct way to respond (if you are
going to respond at all) to such messages.  That's to focus on the substance
of their message and completely ignore the rancor.  I've been the chief
technical guy (including user support) for Musi-Cal for over ten years and
for Mojam for about seven years.  During that time I've received lots of
thanks from people for the service those sites provide.  Every once in
awhile though, I get a message out of the blue from someone who is either
simply an asshole or is having the mother of all bad days.  I've found there
is nothing so satisfying as responding politely to such messages and then to
have their authors come virtually crawling back later with an apology for
having been so out-of-line.

Just a thought...

Skip
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Could anyone write a small program to log the Signal-to-Noise figures for a Netgear DG834 router?

2005-07-27 Thread mustafa
Chris wrote:
 In article [EMAIL PROTECTED], 
 Steven D'Aprano [EMAIL PROTECTED] writes
 
On Tue, 19 Jul 2005 07:24:19 +0100, Chris wrote:
 
 
Could anyone write a small program to log the Signal-to-Noise figures
for a Netgear DG834 router?
 
 
Are you offering to pay somebody to do it, or just suggesting a project
for some Python programmer who is bored and looking for a small project to
work on out of love?
 
 
 Yes, Steven, the latter.  Sometimes programmers need an idea for a 
 project - and, for them, knowing that someone would actually value what 
 they did might make it more fun for them.
hey i would help
i am noob at programming but this will give me good experiance.
please contact me and on the subject write router SNR issue
cuz i get a lot of mail and most i don't open but then i will be able to 
spot yours.
hope i can help.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Create a variable on the fly

2005-07-27 Thread Steve M
PythonWin 2.3.5 (#62, Feb  9 2005, 16:17:08) [MSC v.1200 32 bit
(Intel)] on win32.
Portions Copyright 1994-2004 Mark Hammond ([EMAIL PROTECTED]) -
see 'Help/About PythonWin' for further copyright information.
 locals()['OSCAR'] = 'the grouch'
 OSCAR
'the grouch'


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: html special characters to latin-1 conversion

2005-07-27 Thread Kent Johnson
ulrice jardin wrote:
 hi
 
 I had a look to this htmlentitydefs lib, but I still
 don't know how to convert html special characters into
 latin-1 characters.
 For instance, how can I convert #39; into ' or #233;
 and eacute; into é?

Searching comp.lang.python for 'htmlentitydefs' gives quite a few solutions.

Here is one way:
http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/9b7bb3f621b4b8e4/3b00a890cf3a5e46?q=htmlentitydefsrnum=3hl=en#3b00a890cf3a5e46

Kent
-- 
http://mail.python.org/mailman/listinfo/python-list


Bash Helper Script

2005-07-27 Thread Jeremy Moles
I wrote something real quick this morning that I thought might be
somewhat useful to someone else. It's just a bash script that lets you
do a few things do a project directory (in my case, python subversion
projects) in a decently sensible way. Usage is:

# cp pypadmin MyProjectDir/pypadmin
# ./pypadmin skel
# ./pypadmin clean
# ./pypadmin package
# ./pypadmin publish

The actual targets are kept in ./.pypadmin/NAME, where NAME is one of:

- package_name (name of the tarball that will be created)
- publish_host (name of the host to scp to)
- clean_files  (globs of filenames to delete when clean is invoked)

Running ./pypadmin skel will create a skeleton layout into which you put
these values. For instance:

# ./pypadmin skel
# echo foo.tar.bz2  .pypadmin/package_name
# echo *.pyc  .pypadmin/clean_files
# echo emperorlinux.com:~  .pypadmin/publish_host


pypadmin
Description: application/shellscript
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Create a variable on the fly

2005-07-27 Thread bruno modulix
Paul D.Smith wrote:
 Can Python create a variable on-the-fly.  For example I would like
 something like...
 
 make_variable('OSCAR', 'the grouch');
 print OSCAR;
 
 ...to output...
 
 the grouch
 
 Anything like this in Python?

The bad news is that yes, there is something like this in Python.

The good news is that I won't tell you more about it, since it's a very
bad practice(tm). The good practice is to put your vars in a dict.

 And in case anyone is interested, I want to instantiate a set of variables
 based on environment variables without using os.environ everywhere

 env = os.environ

Now you just have to look at env['MY_ENV_VAR'] !-)

 by having
 a look instantiate Python variables of the appropriate type.

What do you mean of the appropriate type ? You want to typecast (eg.
from string to numeric) ? Then you need to know what env var must be
casted to what type ? Then you don't need to create variables 'on the fly' ?

I must have missed something...


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Problems with permissions etc

2005-07-27 Thread Jeremy Moles
On Wed, 2005-07-27 at 00:36 -0700, Frank Millman wrote:
 Hi all
 
 This is not strictly a Python question, but this newsgroup feels like a
 family to me, so I hope that someone will be kind enough to respond to
 this, or at least point me in the right direction.
 
 While developing under linux, I use my own computer, as the only user,
 so it has become my habit to login as root and do all my work as a
 superuser. I know that this is not desirable, but it has become a
 habit, which I am now trying to get out of.
 
 Now that I am logging in as an ordinary user, I find that a number of
 things that previously 'just worked' have now stopped working. I can
 usually find the cause, and tweak whatever is needed to get it working
 again, but I am wondering how most people work. Is it normal to
 experience these kinds of problems, or am I missing a trick somewhere
 and making my life more complicated than it need be?
 
 I will give two examples. I would like advice on the best way to fix
 them, but I would prefer a more general reply that explains how
 experienced unix/linux users go about handling these kinds of issues.
 
 1. The application I am developing will eventually be deployed as a
 multi-user accounting/business system. I want to identify the physical
 workstation that generates each transaction, so I am using the mac
 address. My method for extracting this is as follows -
   mac = os.popen(ifconfig|grep Ether|awk {print '$5'}).read()[:-1]  #
 I did not come up with this myself, I cribbed it from somewhere
 
 As root, this works fine. As non-root, ifconfig is not found. The
 reason is that it is in /sbin, and this is not included in the default
 path for non-root users. I could either include /sbin in my path, or I
 could change the above line to /sbin/ifconfig ... Alternatively, there
 may be a better way of getting the mac address or identifying the
 workstation.

I 3 sysfs; case in point:

cat /sys/class/net/eth*/address

..we..

 2. I am using wxPython, which was compiled from source. It so happens
 that I did this with a colleague who also has a user account on my
 machine, so the compile and install of wxPython was done from his home
 directory.
 
 When I start my app as non-root, the import of wx fails, as it cannot
 find certain files. They are in the other user's home directory, but as
 the top-level directory has permissions of drwx--, my user cannot
 read anything in that directory. I can change the directory
 permissions, or I can move the files to another area which all users
 can read. If the latter, is there a 'correct' place to put them?
 
 I think that these problems are a result of my lack of experience as a
 system administrator. On the other hand, the various books and articles
 I have read to try and improve my knowledge have not covered these
 kinds of issues. Is it just something that one learns the hard way?
 
 Any advice, especially pointers to reading matter that covers this
 topic, will be much appreciated.
 
 Thanks
 
 Frank Millman
 

-- 
http://mail.python.org/mailman/listinfo/python-list


any thing to do???

2005-07-27 Thread mustafa
i hav just finished learning pythob from A byte of python(an online 
book) so i wanted to apply my new skills. to learn and to have some fun.
is there any place which lists jobs to be done...you know minor jobs and 
requests thats nobody has found time to do.
i would point out that i am not looking for a JOB as job with payment.
i am looking for a JOB that is to be done and nobody has done it yet.

also aside from this is there any other way i could use python and 
improve. i figure this practice will make me a lot better. but if anybody
else has any ideas than that would be good too .

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: any thing to do???

2005-07-27 Thread Paolino
mustafa wrote:
 i hav just finished learning pythob from A byte of python(an online 
 book) so i wanted to apply my new skills. to learn and to have some fun.
 is there any place which lists jobs to be done...you know minor jobs and 
 requests thats nobody has found time to do.
 i would point out that i am not looking for a JOB as job with payment.
 i am looking for a JOB that is to be done and nobody has done it yet.
 
 also aside from this is there any other way i could use python and 
 improve. i figure this practice will make me a lot better. but if anybody
 else has any ideas than that would be good too .
 
Hmm try this:
  http://www.itasoftware.com/careers/eng/job1.php

For really useful things probably you want to reach some projects like 
twisted ,but there you need more experience IMO. Good luck and welcome 
to Python.

Paolino
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Create a variable on the fly

2005-07-27 Thread Willem Broekema
Steve M:
  locals()['OSCAR'] = 'the grouch'
  OSCAR
 'the grouch'
 

Use globals, not locals:

  globals()['OSCAR'] = 'the grouch'

because http://www.python.org/doc/current/lib/built-in-funcs.html
states:

  locals()
  Update and return a dictionary representing the current local symbol
  table. Warning: The contents of this dictionary should not be
  modified; changes may not affect the values of local variables used
  by the interpreter.

Function globals() is not subject to this restriction.


- Willem

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A Module on Time Date

2005-07-27 Thread Fernando Perez
Robert Maas, see http://tinyurl.com/uh3t wrote:

 From: Robert Kern [EMAIL PROTECTED]
 As you can see in the datetime documentation, the module was introduced
 in Python 2.3. I recommend updating your Python installation.
 
 What do you mean your?? I don't have any Python installation of my
 own. All I have is what this small local ISP provides on its Unix shell
 machine which I share with hundreds of other users. There's no way I
 can install a new version of anything on the system account.
 Your recommendation will be disregarded as total crap. plonk

You might also consider learning how to find answers to all your problems by
yourself in the future, as this kind of response to a perfectly reasonable,
valid suggestion pretty much ensures that people won't be terribly inclined to
help you in the future.

Robert's recommendation was valid, to the point, and perfectly feasible. As
Skip further indicated, it's trivial to add your local python; you can also
keep local modules (without a full python) in your own account and configure
$PYTHONPATH.  Your response was rude and stupid.

Cheers,

f

-- 
http://mail.python.org/mailman/listinfo/python-list


[Beginner] Calling a function by its name in a string

2005-07-27 Thread Tito
Hi all:

Is there a metalanguage capability in Python (I know there are many) to 
call a function having its name in a string?

Something like:
__call__(foo)

instead of:
foo()

Regards,
Tito
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Bill Mill
On 7/27/05, Tito [EMAIL PROTECTED] wrote:
 Hi all:
 
 Is there a metalanguage capability in Python (I know there are many) to
 call a function having its name in a string?
 
 Something like:
 __call__(foo)
 
 instead of:
 foo()
 

 def foo(): print foobarred
...
 foo()
foobarred
 eval(foo())
foobarred


Peace
Bill Mill
bill.mill at gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [path-PEP] Path inherits from basestring again

2005-07-27 Thread Ron Adam
Toby Dickenson wrote:
 On Wednesday 27 July 2005 05:37, Meyer, Tony wrote:
 
 
I can see that this would make sense in some situations, but ISTM that it
would make a great deal more sense (and be much more intuitive) to have
concatenation include the separator character (i.e. be join).  
 
 
 def functions_which_modifies_some_file_in_place(path):
  output = open(path+'.tmp', 'w')
  .
 
 I dont want a seperator inserted between path and the new extension.

My impression of '+', is it always join like objects...

str+str - str
list+list - list
tuple+tuple - tuple

So ...

path+path - path

In all current cases, (that I know of), of differing types, '+' raises 
an error.

Question:  Is a path object mutable?

Would the += operator create an new object or modify the original?

p = path('C://somedir//somefile')

p+='.zip'  what would this do?

p[-1]+='.zip'  Or this?


Cheer's Ron.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Paolino
Tito wrote:
 Hi all:
 
 Is there a metalanguage capability in Python (I know there are many) to 
 call a function having its name in a string?
 
 Something like:
 __call__(foo)
 
 instead of:
 foo()
 
 Regards,
 Tito
eval('foo()') should do, but it's said a bad practice ;)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter - Resizing a canvas with a window

2005-07-27 Thread Gordon Airporte
Thanks you very much. I found something interesting though, the canvas's 
width and height properties are not updated when it is resized by its 
packing. Looks like an oversight to me, but I've just demonstrated that 
I don't have a complete grasp of Tk, so... I can use a Configure 
callback to keep track of the values, however.


from Tkinter import *

class testApp3:
 def __init__( self, master ):
 self.ma = master
 self.f = Frame( self.ma )
 self.f.pack(fill=BOTH, expand=YES)
 self.cv = Canvas(self.f, width=125, height=125, bg='red')
 self.cv.pack(fill=BOTH, expand=YES)
 self.b1 = Button( self.f, text='Hello', height=1, width=10, 
padx=0, pady=1, \
   command = self.howbig )
 self.b1.pack(side=BOTTOM, anchor=S, padx=4, pady=4)
 self.cv.bind('Configure', self.resize )

 def howbig( self ):
 print self.cv['width'], self.cv['height']
 print self.cvw, self.cvh

 def resize( self, event ):
 print '(%d, %d)' % (event.width, event.height)
 self.cvw, self.cvh = event.width-4, event.height-4

root = Tk()
app = testApp3(root)
root.mainloop()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: GUI - Windows: Where to get started

2005-07-27 Thread Larry Bates
First you need to pick up a copy of Python Programming for Win32
book.  It is a good starting place for GUI as well as COM and
writing services.  It was well worth the price to me.

-Larry

Ernesto wrote:
 Hi all,
 
 Would anyone know a good place to start for learning how to build
 simple GUI's in Windows XP?  I just want users to be able to select a
 few parameters from a pull-down menu, then be able to run some batch
 files using the parameters from the pull down menus.  I would also need
 a Browse menu, so users could point to a place on the local disc (ie
 C:\PointSystemHere).  Can anyone give a noob some tips?  THANKS!!!
 
-- 
http://mail.python.org/mailman/listinfo/python-list


can list comprehensions replace map?

2005-07-27 Thread David Isaac
Newbie question:

I have been generally open to the proposal that list comprehensions
should replace 'map', but I ran into a need for something like
map(None,x,y)
when len(x)len(y).  I cannot it seems use 'zip' because I'll lose
info from x.  How do I do this as a list comprehension? (Or,
more generally, what is the best way to do this without 'map'?)

Thanks,
Alan Isaac


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Michael Hoffman
Tito wrote:
 Hi all:
 
 Is there a metalanguage capability in Python (I know there are many) to 
 call a function having its name in a string?
 
 Something like:
 __call__(foo)
 
 instead of:
 foo()

locals()[foo]() will be a little more predictable than eval(foo()).
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Grant Edwards
On 2005-07-27, Paolino [EMAIL PROTECTED] wrote:

 Is there a metalanguage capability in Python (I know there are many) to 
 call a function having its name in a string?

 eval('foo()') should do, but it's said a bad practice ;)

An alternative to eval() is:

 def foo():
...   print foo was called
... 
 s = foo
 globals()[s]()
foo was called
 

-- 
Grant Edwards   grante Yow!  I'm meditating on
  at   the FORMALDEHYDE and the
   visi.comASBESTOS leaking into my
   PERSONAL SPACE!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can list comprehensions replace map?

2005-07-27 Thread Michael Hoffman
David Isaac wrote:
 Newbie question:
 
 I have been generally open to the proposal that list comprehensions
 should replace 'map', but I ran into a need for something like
 map(None,x,y)
 when len(x)len(y).  I cannot it seems use 'zip' because I'll lose
 info from x.  How do I do this as a list comprehension? (Or,
 more generally, what is the best way to do this without 'map'?)

It ain't broke so I'd stick with what you're doing. Even if map() is 
removed as a builtin, it will surely stick around in a module.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can list comprehensions replace map?

2005-07-27 Thread Michael Hoffman
Michael Hoffman wrote:
 David Isaac wrote:
 
 Newbie question:

 I have been generally open to the proposal that list comprehensions
 should replace 'map', but I ran into a need for something like
 map(None,x,y)
 when len(x)len(y).  I cannot it seems use 'zip' because I'll lose
 info from x.  How do I do this as a list comprehension? (Or,
 more generally, what is the best way to do this without 'map'?)
 
 
 It ain't broke so I'd stick with what you're doing. Even if map() is 
 removed as a builtin, it will surely stick around in a module.

Addendum: I know this doesn't answer your question, so if you were 
asking out of purely academic interest, then someone else will probably 
post another answer.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Wrapping a class set method

2005-07-27 Thread snoe
Hi there,

I have the following simplified classes:

class Project:
def __init__(self,pname):
self.devices = {} # Dictionary of Device objects
self.pname = pname

def setpname(self,pname):
self.pname = pname

def adddevice(self,dname):
self.devices[dname] = Device(self,dname)

class Device:
def __init__(self,parent,dname):
self.parent = parent
self.dname = dname

def setdname(self,dname):
self.dname = dname

Now, what I would like to do is wrap all of the set/add methods in a
function that pickles the Project object. I would then save the pickled
objects and use them to undo any changes to the above data structures.

I have a suspicion that there's an easier way to do this than
explicitly adding a Project.pickleme() call to the beginning of all of
my set/add methods.

So is there a way to wrap methods for this type of functionality or is
there another way of doing this, maybe without using setter methods?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can list comprehensions replace map?

2005-07-27 Thread Larry Bates
This isn't really a question about list
comprehensions as you are using a feature
of map by passing None as the function to be
executed over each list element:

This works when len(x)  len(y):

zip(x,y+(len(x)-len(y))*[None])

This works when len(y) =0 len(x):

zip(x+(len(x)-len(y))*[None],y)

I would probably wrap into function:

def foo(x,y):
if len(x)  len(y):
return zip(x,y+(len(x)-len(y))*[None])

return zip(x+(len(x)-len(y))*[None],y)

Larry Bates

David Isaac wrote:
 Newbie question:
 
 I have been generally open to the proposal that list comprehensions
 should replace 'map', but I ran into a need for something like
 map(None,x,y)
 when len(x)len(y).  I cannot it seems use 'zip' because I'll lose
 info from x.  How do I do this as a list comprehension? (Or,
 more generally, what is the best way to do this without 'map'?)
 
 Thanks,
 Alan Isaac
 
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [path-PEP] Path inherits from basestring again

2005-07-27 Thread Michael Hoffman
Ron Adam wrote:

 In all current cases, (that I know of), of differing types, '+' raises 
 an error.

Not quite:

  hello  + uworld
u'hello world'
  4.5 + 5
9.5

 Question:  Is a path object mutable?

No.

This should answer the rest of your questions.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Tito
Thank you both for your quick answers.

What I wanted is to parameterize a function with another member 
function, like this:

def printFunctionForEach(collection, functionName):
   for elem in collection:
 print eval(elem. + functionName + ())

Moreover, I wanted to do it with a property:

def printPropertyForEach(collection, propertyName):
   for elem in collection:
 print eval(elem. + propertyName)

Is there another approach to do it?

Regards,
Tito
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Tito
 Thank you both for your quick answers.

Thank you *all* for your quick answers.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Create a variable on the fly

2005-07-27 Thread Do Re Mi chel La Si Do
Hi !

Try :

OSCAR='the grouch'
print OSCAR


useless to thank me

Michel Claveau 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Bill Mill
On 7/27/05, Tito [EMAIL PROTECTED] wrote:
 Thank you both for your quick answers.
 
 What I wanted is to parameterize a function with another member
 function, like this:
 
 def printFunctionForEach(collection, functionName):
for elem in collection:
  print eval(elem. + functionName + ())
 
 Moreover, I wanted to do it with a property:
 
 def printPropertyForEach(collection, propertyName):
for elem in collection:
  print eval(elem. + propertyName)
 
 Is there another approach to do it?
 

Sure, piece of cake:

 class test:
... def func1(self): print 'func1 called'
...
 class test2:
... def func1(self): print 'other func1'
...
 x = [test(), test2(), test()]
 def call_this_func(lst, func_name):
... for e in lst:
... getattr(e, func_name)()
...
 call_this_func(x, 'func1')
func1 called
other func1
func1 called


Note that the getattr raises an AttributeError if func_name doesn't
exist in the object; you should probably wrap it in a try/except.

Peace
Bill Mill
bill.mill at gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multilanguage site and user informations edition

2005-07-27 Thread limi
Plone 2.1 RC is released on Monday. Hopefully the LinguaPlone update is
available that same week.

If you can't wait that long, I suggest you stick to Plone 2.0.5 and
LinguaPlone 0.7.x.

-- Alexander

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Paul Rubin
Tito [EMAIL PROTECTED] writes:
 def printPropertyForEach(collection, propertyName):
for elem in collection:
  print eval(elem. + propertyName)
 
 Is there another approach to do it?

Yes, use the getattr function:

   for elem in collection:
 print getattr(elem, propertyName)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Building Python with Tcl/Tk on Cygwin_NT-5.1

2005-07-27 Thread Jason Tishler
On Mon, Jul 25, 2005 at 03:02:45PM -0700, [EMAIL PROTECTED] wrote:
 Let me know when you have it solved.

The problem has been fixed in Cygwin CVS:

http://cygwin.com/ml/cygwin/2005-07/msg01257.html
http://cygwin.com/ml/cygwin-cvs/2005-q3/msg00046.html

 In the meantime, I have a workaround.

Unfortunately, you will have to live with your workaround until Cygwin
1.5.19 is released. :,(

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: multiple inheritance super()

2005-07-27 Thread rafi
Michele Simionato wrote:
I am mostly
using old style (without type unification) init but this motivate the
shift for the new style. Is there somewhere a document about this?
 
 Yes, see http://www.python.org/2.3/mro.html by yours truly
 
Michele Simionato

Thanks a lot

-- 
rafi

Imagination is more important than knowledge.
(Albert Einstein)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Beginner] Calling a function by its name in a string

2005-07-27 Thread Tito
Once again: thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Supporting and operators in C extension type

2005-07-27 Thread Pedro Werneck

Hi list


I'm trying to implement a new type in a C extension and it must support
some binary operators, like , |, ^,  and . With , | and ^, the
method must receive another object of the same type, perform the
operation with an attribute of both, create a new object with the result
as the attribute and return it. 

Everything works perfectly with , | and ^, but with  and  I need
to, pass an integer as argument, not an object of the same type. The
method should receive an integer, perform the shift with the attribute,
create the new object and return it. The problem is that it only works
with another object of the same type.

It's strange because obj.__lshift__ returns the method; when I call
obj.__lshift__(a) or obj  a, when a is an object of the same type, the
call suceeds (but the object returned has the wrong value, of course),
but with obj.__lshift__(i) where i is an integer, the call returns
NotImplemented and with obj  i it raises TypeError: unsupported
operand types for .

I searched the Objects/ directory in the interpreter source code, but
could not find any solution for this. Seems like it does some kind of
type-checking somewhere when using these binary operators. Do I need to
implement the __coerce__ method or use some wrapper with the method
function ?

Here is the relevant piece of my source code:

The __lshift__ method:

/* Pin.__lshift__() */
static PyObject *
Pin_oplshift(PinObject *self, PyObject *args){

  PinObject *result;
  int shift;

  if (!PyArg_ParseTuple(args, i, shift))
   return NULL;

  result = PyObject_NEW(PinObject, PinType);
  result-pin = self-pin  shift;

  Py_INCREF(result);
  return (PyObject *) result;
};

The part of the PyNumberMethods struct:

/* Pin number methods */
static PyNumberMethods PinAsNumber[] = {
...

  (inquiry)Pin_nonzero,  /*nb_nonzero*/
  0, /*nb_invert*/
  (binaryfunc)Pin_oplshift,  /*nb_lshift*/
  (binaryfunc)Pin_oprshift,  /*nb_rshift*/
  (binaryfunc)Pin_and,   /*nb_and*/
  (binaryfunc)Pin_xor,   /*nb_xor*/
  (binaryfunc)Pin_or,/*nb_or*/
  0, /*nb_coerce*/

...
};


Thanks for any help...

-- 
Pedro Werneck
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can list comprehensions replace map?

2005-07-27 Thread Paolino
David Isaac wrote:
 Newbie question:
 
 I have been generally open to the proposal that list comprehensions
 should replace 'map', but I ran into a need for something like
 map(None,x,y)
 when len(x)len(y).  I cannot it seems use 'zip' because I'll lose
 info from x.  How do I do this as a list comprehension? (Or,
 more generally, what is the best way to do this without 'map'?)

Probably zip should change behaviour,and cover that case or at least 
have another like 'tzip' in the __builtins__ .Dunno, I always thought 
zip should not cut to the shortest list.
 Thanks,
 Alan Isaac
 
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Building Python with Tcl/Tk on Cygwin_NT-5.1

2005-07-27 Thread Dean N. Williams


Jason,

Thanks for fixing this bug in Cygwin. Remember there was another 
undefined variable for the Python build _bsd...

Best regards,  
Dean

On Mon, Jul 25, 2005 at 03:02:45PM -0700, [EMAIL PROTECTED] wrote:
  

Let me know when you have it solved.



The problem has been fixed in Cygwin CVS:

http://cygwin.com/ml/cygwin/2005-07/msg01257.html
http://cygwin.com/ml/cygwin-cvs/2005-q3/msg00046.html

  

In the meantime, I have a workaround.



Unfortunately, you will have to live with your workaround until Cygwin
1.5.19 is released. :,(

Jason

  


-- 
http://mail.python.org/mailman/listinfo/python-list


Why Tcl/Tk?

2005-07-27 Thread Jerry He
I'm a little curious, why does most scripting
languges(i.e. python and ruby) use Tcl/Tk rather than
wx or Fox as its standard GUI? Although I did notice
that the Vpython IDE that uses Tkinker starts up a lot
faster than the DrPython IDE that uses wxpython. But
that makes no sense, Tk is based on Tcl, a scripting
language, but wx is written in C++. 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can list comprehensions replace map?

2005-07-27 Thread Andrew Dalke
David Isaac wrote:
 I have been generally open to the proposal that list comprehensions
 should replace 'map', but I ran into a need for something like
 map(None,x,y)
 when len(x)len(y).  I cannot it seems use 'zip' because I'll lose
 info from x.  How do I do this as a list comprehension? (Or,
 more generally, what is the best way to do this without 'map'?)

If you know that len(x)=len(y) and you want the same behavior as
map() you can use itertools to synthesize a longer iterator


 x = [1,2,3,4,5,6]
 y = Hi!
 from itertools import repeat, chain
 zip(x, chain(y, repeat(None)))   
[(1, 'H'), (2, 'i'), (3, '!'), (4, None), (5, None), (6, None)]
 

This doesn't work if you want the result to be max(len(x), len(y))
in length - the result has length len(x).

As others suggested, if you want to use map, go ahead.  It won't
disappear for a long time and even if it does it's easy to
retrofit if needed.

Andrew
[EMAIL PROTECTED]

-- 
http://mail.python.org/mailman/listinfo/python-list


MESSAGE NOT DELIVERED: Returned mail: Data format error

2005-07-27 Thread dan
Your message could not be delivered. The User is out of space. Please try to 
send your message again at a later time.
-- 
http://mail.python.org/mailman/listinfo/python-list


searching string url

2005-07-27 Thread googlinggoogler
Hiya,

Im trying to find a method of searching a html file (ive grabbed it
with FancyURLopener), basically in the html file there is a series of
links in the following format -

A HREF=../../company/11/13/820.htmsome name/A

so I want to search the file for ../../company/ and then get the 13
charecters after it so that I can work it as a URL, if you see what I
mean?

Very gratefully

David

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why Tcl/Tk?

2005-07-27 Thread Robert Kern
Jerry He wrote:
 I'm a little curious, why does most scripting
 languges(i.e. python and ruby) use Tcl/Tk rather than
 wx or Fox as its standard GUI?

Way back in the day, wx and Fox didn't exist (at least not in a usable 
form) while Tcl/Tk was rock-solid stable.

 Although I did notice
 that the Vpython IDE that uses Tkinker starts up a lot
 faster than the DrPython IDE that uses wxpython. But
 that makes no sense, Tk is based on Tcl, a scripting
 language, but wx is written in C++. 

Scripting language != slow.
C++ != fast.

-- 
Robert Kern
[EMAIL PROTECTED]

In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die.
   -- Richard Harter

-- 
http://mail.python.org/mailman/listinfo/python-list


acidulous courtyard izvestia rutabaga bushy attribute sicily stayed starlet lance chaos crest donald fondle backwater revisionary fanciful wanton terre calf purport indissoluble become transom antigen pokerface shrubbery behave lineal chrysler pyroxenite eyeful checklist downing

2005-07-27 Thread Judy Dunn
PROGRAMS AND GAMES!



www.geocities.com/software1
































































rotateacquaintbehindbespeakbreathygabbleprofiteerporous.edmundcannelcaramel. flutedarwindutydioriteashleyconservativebaptism.episodicfaabarnetcliveaboutlibertarianjealousy. syllabifyvisadonahuebasicfindgarry.malnutritiondisc. moribundaureliusbooze.commonprimateamocosaulpitifulcommissariat.retireeshafferplastic.
Creature that refuses to be what he is. Man thinks woman. We have the right attitude toward others. The best argument against. Should. Sometimes things seem to happen of their own accord. Spending. Collectively, in interfering with the liberty of action of any of. Broke with you was more than bread. Now that I am without you, all is. Few immutable truths today. There are two kinds of people, those who. Invitation to begin your day in a state of crippling rage. The wish to. People are responsible for what they do unless they are insane. People. Giving creates lvoe. Knowing yourself lets you understand others. From being overwhelmed by the tribe. To be your own man is a hard. Permits us to acquiesce in an erroneous theory is the lack of a better. Opportunity, the most important thing in life is to know when to. Fool who does not understand what you are promising, or deliberately. We have the right attitude toward others. The best argument against. Distance between two people. Laws are only words words written on. Be silent, and be thought a fool, than to speak and remove all doubt. Honestly and courageously uses his intelligence. Guilt and. Power of our country. We are governed, our minds molded, our tastes. Mans opinions; I have my own. I think that, as life is action and. Enslave mankind, and monopolize power and profit. All of us who are. Creature that refuses to be what he is. Man thinks woman. We have the right attitude toward others. The best argument against. Should. Sometimes things seem to happen of their own accord. Spending. Collectively, in interfering with the liberty of action of any of. Broke with you was more than bread. Now that I am without you, all is. Few immutable truths today. There are two kinds of people, those who. Invitation to begin your day in a state of crippling rage. The wish to. People are responsible for what they do unless they are insane. People. Giving creates lvoe. Knowing yourself lets you understand others. From being overwhelmed by the tribe. To be your own man is a hard. Permits us to acquiesce in an erroneous theory is the lack of a better. Opportunity, the most important thing in life is to know when to. Fool who does not understand what you are promising, or deliberately. We have the right attitude toward others. The best argument against. Distance between two people. Laws are only words words written on. Be silent, and be thought a fool, than to speak and remove all doubt. Honestly and courageously uses his intelligence. Guilt and. Power of our country. We are governed, our minds molded, our tastes. Mans opinions; I have my own. I think that, as life is action and. Enslave mankind, and monopolize power and profit. All of us who are. -- 
http://mail.python.org/mailman/listinfo/python-list

Re: searching string url

2005-07-27 Thread Devan L
Sounds somewhat like homework. So I won't just give you a code
solution. Use the regular expression(re) module to match the urls.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: searching string url

2005-07-27 Thread Robert Kern
[EMAIL PROTECTED] wrote:
 Hiya,
 
 Im trying to find a method of searching a html file (ive grabbed it
 with FancyURLopener), basically in the html file there is a series of
 links in the following format -
 
 A HREF=../../company/11/13/820.htmsome name/A
 
 so I want to search the file for ../../company/ and then get the 13
 charecters after it so that I can work it as a URL, if you see what I
 mean?

You want to use BeautifulSoup.

   http://www.crummy.com/software/BeautifulSoup/

-- 
Robert Kern
[EMAIL PROTECTED]

In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die.
   -- Richard Harter

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: question about deleting records from mysql

2005-07-27 Thread Cantankerous Old Git
nephish wrote:
 Man, thanks for the link. and the tip. i am testing
 the db.commit() and printing the doc right now.
 thanks again.

If it's any help, using

 cursor.execute(set autocommit = 1)

before doing anything else works nicely unless you actually need 
transactions.

The Cog
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Building Python with Tcl/Tk on Cygwin_NT-5.1

2005-07-27 Thread Jason Tishler
Dean,

On Wed, Jul 27, 2005 at 12:41:05PM -0700, Dean N. Williams wrote:
 Thanks for fixing this bug in Cygwin.

You are welcome.  However, I didn't fix it -- I just got it fixed. :,)

 Remember there was another undefined variable for the Python build
 _bsd...

I didn't get this error.  Did you forgot to install one of the
libdb${version}-devel packages:

$ cygcheck -cd | grep 'libdb.*-devel'
libdb2-devel2.7.7-4
libdb3.1-devel  3.1.17-2
libdb4.1-devel  4.1.25-1
libdb4.2-devel  4.2.52-1

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >