Re: Parsing an HTML a tag

2005-09-24 Thread Stephen Prinster
George wrote:
> How can I parse an HTML file and collect only that the A tags. I have a
> start for the code but an unable to figure out how to finish the code.
> HTML_parse gets the data from the URL document. Thanks for the help

Have you tried using Beautiful Soup?

http://www.crummy.com/software/BeautifulSoup/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: AJAX => APAX? Or: is there support for python in browsers?

2005-11-15 Thread Stephen Prinster
Roger Erens wrote:

> 
> I'm asking because of all the AJAX hype going on. I'd like rather not
> delve too deep into JavaScript and use Python instead.
> 
> Any insights to be shared?
> 
> Cheers,
> Roger

In addition to the others already mentioned, you might want to check out
Nevow.  Quoting from the website:

"Finally, Nevow includes LivePage, a two-way bridge between Javascript
in a browser and Python on the server. LivePage is compatible with
Mozilla, Firefox, Windows Internet Explorer 6, and Safari on Mac OS X.
Event handlers can be written in pure Python and Javascript
implementation details are hidden from the programmer, with Nevow taking
care of routing data to and from the server using XmlHttpRequest."

http://divmod.org/trac/wiki/DivmodNevow


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


Re: Sending an event from a python COM server to a VB COM client

2005-11-15 Thread Stephen Prinster
Gary Kshepitzki wrote:
> Hello
> I am trying to send an event from a Python COM server to a VB (or VB.NET) 
> COM client.
> I am a newbie both in VB and in python.
> Can anyone give me a simple (but complete) code example both of the Python 
> server side and the VB client side for raising a single event.
> 
> Any answer would be highly appreciated.
> Regards
> Gary
> 
> 

I suggest the book _Python Programming on Win32_ by Mark Hammond and
Andy Robinson.  There is a chapter online and I believe it even includes
the example you need.

http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html

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


Re: UUID?

2005-11-28 Thread Stephen Prinster
Huang Zhen wrote:
> Hello,
> How can I get a UUID with python?
> Thanks!

I've never used this, but I just saw it on Planet Python this morning:

http://www.livejournal.com/users/zestyping/157957.html

HTH,
Steve P.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Proposal: Inline Import

2005-12-09 Thread Stephen Prinster
Shane Hathaway wrote:
> Do you have any ideas on how to improve the process of maintaining
> imports?  Benji's suggestion of jumping around doesn't work for moving
> code and it interrupts my train of thought.  Sprinkling the code with
> import statements causes a speed penalty and a lot of clutter.
> 
> I'm actually quite surprised that others aren't bothered by the process
> of maintaining imports.  Perhaps the group hasn't spent time in Eclipse
> to see what a relief it is to have imports managed for you.  The
> difference isn't enough to make anyone jump ship to Java, but it's a
> real improvement.
> 
> Shane

Have you looked at py lib?  Particularly the py.std hook?

http://codespeak.net/py/current/doc/misc.html

It's not exactly what you want, but it might help you.  I must agree
with everyone else, though.  I have never felt a need for what you are
describing.

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


Re: Office COM automatisation - calling python from VBA

2005-06-24 Thread Stephen Prinster
guy lateur wrote:
> So, ideally, I'd like to program as much as possible in python (I'm
> pretty new to that, too, btw), and only use VBA if needed - say, to
> call python objects/methods (+ wxGUI, please).
> 

If you are new to Python and want to use it with COM, definitely get
yourself a copy of _Python Programming on Win32_ by Mark Hammond and
Andy Robinson.

Read the first few chapters to get yourself started, then ask more
specific questions here.  There always seem to be lots of helpful answers.

Good luck!

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


Re: Python library/module for MSAccess

2005-08-26 Thread Stephen Prinster
Jonathon Blake wrote:

> [ Editing/creating msaccess databases on a Linux Box, and WINE _not_ 
> installed.]

I'm pretty sure I don't understand what you are wanting to do.  You say
you have   "msaccess databases on a Linux Box" and you are not using the
Jet Database engine.  As far as I know, MS Access is just a front-end to
databases, with Jet as the default backend (though it can connect to
many others).  What backend database engine/storage format are you
using?  There might be a python library for connecting to it, bypassing
Access altogether.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread Stephen Prinster
grumfish wrote:
 The rowcount of the
cursor is 1 after the execute is 1 and the table's auto_increment value 
is increased for each insert done. 
If the auto_increment is increased, then it seems like the row was 
inserted.  Are you sure the problem is not with your SELECT attempt? 
Just a guess, but it seems like the first time I used MySQLdb, I was 
confused by the need to do a "fetchall()" (or "fetchone()" or 
"fetchmany()") after executing the SELECT.

Something like this (not tested):
result = cursor.execute(SELECT * FROM edict WHERE kanji = 'a')
print result.fetchall()
HTH,
Steve P.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Question about python code distribution...

2005-04-28 Thread Stephen Prinster
[EMAIL PROTECTED] wrote:
> Hi,
> 
> I am sure that this question might have come up repeatedly. Companies
> may not want to distribute their python code in source form. Even
> though pyc files are one option, it gets inconvenient to distribute
> bunch of them . If there is some way to bundle pyc files (akin to
> .jar), it would be really nice. I understand that pyc files are not
> hard to decompile (from my reading of previous posts) and module
> startup times may be longer if they have to be read from an archive.
> Neverthless, an option to distribute in the form of an archive is
> attractive. Has this ever been considered for Python? If one were to
> consider it, what would be pros and cons of such approach?
> 
> Any comments are appreciated.
> 
> Thanks,
> Raghu.
> 

Looks like it's in the works:
http://peak.telecommunity.com/DevCenter/PythonEggs

Cheers,
Steve
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb - Query/fetch don't return result when it *theorically* should

2006-01-18 Thread Stephen Prinster
Have you tried doing a "connection.commit()" after each query attempt?
I believe mysqldb also has a connection.autocommit feature.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to extract 2 integers from a string in python?

2006-06-08 Thread Stephen Prinster
[EMAIL PROTECTED] wrote:
> Hi,
> 
> how can I extract 2 integers from a string in python?
> 
> for example, my source string is this:
> Total size: 173233 (371587)
> 
> I want to extract the integer 173233 and 371587 from that soource
> string, how can I do that?
> 

Use split() to split the string into four strings, using spaces as
separators, then use int() to convert the resulting strings that
interest you.

>>> a, b, c, d = 'Total size: 173233 (371857)'.split()
>>> first_int, second_int = int(c), int(d[1:-1])
>>> first_int
173233
>>> second_int
371857

HTH
Steve P
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Impact Analysis Tool ?

2005-05-25 Thread Stephen Prinster
Paul McNett wrote:
> Terry Hancock wrote:
> 
>> On Wednesday 25 May 2005 08:27 am, [EMAIL PROTECTED] wrote:
>>
>>> Is there an impact analysis tool out there that can cross reference
>>> python -- VB has a couple of these tools (eg. Visual Expert)
>>
>>
>> I could be wrong, but my first impression is that that must be
>> VB jargon for something we might know under another name.
> 
> 
> Yep, I think we know it as 'unit testing'.
> 
> From the Visual Expert site (http://visual-expert.com), impact analysis
> refers to taking a given variable or function name, and finding
> everywhere in the project where that name is referenced, for the purpose
> of determining what bad things will happen when that variable or
> function is changed somehow. The tool won't tell you what bad things
> will happen, just list other code segments that depend on the name in
> question.

This also sounds a little bit like "refactoring."
The OP may want to look at Bicycle Repair Man:

http://bicyclerepair.sourceforge.net/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner question: Logs?

2005-06-01 Thread Stephen Prinster
Svens wrote:
> Hey thanks...
> 
> Still getting an error message though.  Here's what i'm doing:
> --
> import math
> log10(15625)
> --
> -It says that log10 is not defined, but it is since the module is
> imported, right?
> 

try this:

import math
math.log10(15625)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (question) How to use python get access to google search without query quota limit

2006-05-05 Thread Stephen Prinster
Per wrote:
> I am doing a Natural Language processing project for academic use,
> 
> I think google's rich retrieval information and query-segment might be
> of help, I downloaded google api, but there is query limit(1000/day),
> How can I write python code to simulate the browser-like-activity to
> submit more than 10k queries in one day?

Would Yahoo's API work for you?  IIRC, it allows 5000 queries per day
and up to 100 results per query.  It also includes some easy-to-use
Python examples.

Or, if you are willing to pay for it, you can get as many queries as you
want from Alexa.

HTH,
Steve P.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do I Need This?

2006-04-08 Thread Stephen Prinster
Terry Reedy wrote:
  There
> may be a page at python.com that explains more.
> 

I think you meant python.org.

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