Re: How to Retrieve Data from an HTTPS://URL

2006-01-06 Thread LordLaraby
You might be using ActiveState python on Windows? If so, you most
likely do not have the SSL layer that's required to process HTTPS
protocol queries.
You should install 'standard' Python from python.org to get the SSL
handling functionality. I understand that ActiveState can not
distribute the SSL code, for national security reasons. :-)

LL

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


Re: getting a KeyError:'href' any ideas?

2006-01-06 Thread LordLaraby
You wrote:
> i have an
> href which looks like this:
> 
> http://www.cnn.com";>
> 
> here is my code
> for incident in row('td', {'class':'all'}):
> n = incident.findNextSibling('a', {'class': 'btn'})
> link = incident.findNextSibling['href'] + "','"
> any idea what i'm doing wrong here with the syntax?  thanks in advance
Since you already found the anchor tag with the 'btn' class attribute,
just grab it's href attribute like so:
for incident in row('td', {'class':'all'}):
   n = incident.findNextSibling('a', {'class': 'btn'})
   link = n['href'] + "','"

Works for me...

LL

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


Re: CGI question

2006-01-06 Thread LordLaraby
sophie,

If you have the URL in a variable, it's easy to parse it into it's
components (one of which is the query string) like so:

>>> from urllib2.urlparse import urlparse
>>> urlparse( \
"http://[EMAIL 
PROTECTED]:8080/mytext.php;hellothere?this=test+value&and=that+one#anchor")
('http', '[EMAIL PROTECTED]:8080', '/mytext.php', 'hellothere',
'this=test+value&and=that+one', 'anchor')
>>> print _[4]
this=test+value&and=that+one
>>> print _.split('&')
['this=test+value','and=that+one']

Then just use unquote_plus() from urllib to get the original query
arguments.

Hope that fills in some of the missing links. :-)

LL

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


Re: is there a smaple to create syslog server on Windows.

2006-01-06 Thread LordLaraby
WIndows has a syslog server. It's called the Windows Event Log. No need
to build a whole new one. *grin*

Now... if you just want an app that listens on a log port and sends
it's message to the Event Log, then I can't help you but to suggest
that a *nix knowledgable programmer may help you write one.

Actually, I've considered writing such a thing myself -- just haven't
had the time. Maybe googling for a syslog to EventLog service might
turn something up.

Sorry I'm not more help,

LL

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


Re: smtplib error('Connection reset by peer')

2006-01-06 Thread LordLaraby
Do you actually run an SMTP server on your local machine and is it
configured to accept mail on the localhost interface and does it allow
mail forwarding such as you attempted?

LL

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


Re: What's wrong with this code snippet?

2006-01-06 Thread LordLaraby
For what it's worth, GenerateRandomColour does not access any instance
variables and therefore needn't even be a member of the class
Population. If you wanted it there for encapsulation purposes, consider
making it a staticmethod like so:

@staticmethod()
def GenerateRandomColour():
rn.seed()
colour = rn.choice(['C', 'P', 'Z'])
return colour 

Just something to consider...

LL

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


Re: Shrinky-dink Python (also, non-Unicode Python build is broken)

2006-01-16 Thread LordLaraby
I myself wonder why python.dll can't just load a companion i18n.dll
when and if it's called for in the script. Such as by having week
references to those functions and loading the dll as needed.And
probably throwing an exception if it can't be loaded. Most of the CJK
stuff could then be carried in that DLL and in some cases, such as
py2exe, not even be included because it's not used.

Just my 2 cents.

LL

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


Re: Decimal ROUND_HALF_EVEN Default

2006-01-16 Thread LordLaraby
If 'bankers rounding' is HALF_ROUND_EVEN, what is HALF_ROUND_UP? I
confess to never having heard the terms.
I usually do: Y = int(X + 0.5) scaled to proper # of decimal places.
Which type of rounding is this? If either.

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