On Fri, 14 Nov 2008 16:03:13 +0100, Gilles Ganault <[EMAIL PROTECTED]>
wrote:
>I need a library that supports both going out through a proxy, and
>handling cookies automagically (the server uses a sessionID to keep
>track of the user).
For those interested, it seems like a good
On Fri, 14 Nov 2008 17:39:00 +0100, "Martin v. Löwis"
<[EMAIL PROTECTED]> wrote:
>Can you first please report what happened when you add the print statement?
Thanks guys, I found how to handle this:
===
for id in rows:
#Says Unicode, but it's actually not
#print type(id[1]
Hello
I fill two dictionaries with the same number of keys, and then need to
compare the value for each key, eg.
#Pour chaque APE, comparaison societe.ape.nombre et verif.ape.nombre
import apsw
#
dic1={}
[...]
rows=list(cursor.execute(sql))
for id in rows:
dic1[id[0]] = id[1]
Hello
I'm using urllib2 to download web pages. The strange thing in the code
below, is that it seems like urllib2.urlopen retries indefinitely by
itself instead of raising an exception:
=
timeout = 30
socket.setdefaulttimeout(timeout)
i = 0
while i < 5:
Hello
As a newbie, it's pretty likely that there's a smarter way to do this,
so I'd like to check with the experts:
I need to try calling a function 5 times. If successful, move on; If
not, print an error message, and exit the program:
=
success = None
for i in range(5):
#Try to fet
On 19 Nov 2008 14:37:06 + (GMT), Sion Arrowsmith
<[EMAIL PROTECTED]> wrote:
>Note very carefully that the "else" goes with the "for" and not the "if".
Thanks guys.
--
http://mail.python.org/mailman/listinfo/python-list
Hello
I must be dense, but I still don't understand 1) why Python sometimes
barfs out this type of error when displaying text that might not be
Unicode-encoded, 2) whether I should use encode() or decode() to solve
the issue, or even 3) if this is a Python issue or due to APWS SQLite
wrapper that
Hello
I'm stuck at why Python doesn't return the first line in this simple
regex:
===
response = "Address :\r\t\t\r\t\t\t3 Abbey Road,
St Johns Wood \r\t\t\tLondon, NW8 9AY\t\t"
re_address = re.compile('Address
:.+?(.+?)',re.I | re.S | re.M)
address = re_address.search(response)
if addr
On Mon, 16 Mar 2009 01:14:00 +0100, Gilles Ganault
wrote:
>I'm stuck at why Python doesn't return the first line in this simple
>regex
Found it: Python does extract the token, but displaying it requires
removing hidden chars:
=
response = "Address :\r\t\t\r\t\t\t3 Abbe
On Fri, 13 Mar 2009 14:24:52 +0100, Peter Otten <__pete...@web.de>
wrote:
>It seems the database gives you the strings as unicode. When a unicode
>string is printed python tries to encode it using sys.stdout.encoding
>before writing it to stdout. As you run your script on the windows commmand
>line
Hello
Some of the adresses are missing a space between the streetname and
the ZIP code, eg. "123 Main Street01159 Someville"
The following regex doesn't seem to work:
#Check for any non-space before a five-digit number
re_bad_address = re.compile('([^\s].)(\d{5}) ',re.I | re.S | re.M)
I also tr
On Sat, 21 Mar 2009 08:53:10 -0500, Tim Chase
wrote:
>It looks like it's these periods that are throwing you off. Just
>remove them. For a 3rd syntax:
>
>(\S)(\d{5})
>
>the \S (capital, instead of "\s") is "any NON-white-space character"
Thanks guys for the tips.
--
http://mail.python.org/
Hello
I'd like to go through a list of e-mail addresses, and extract those
that belong to well-known ISP's. For some reason I can't figure out,
Python shows the whole list instead of just e-mails that match:
=== script
test = "t...@gmail.com"
isp = ["gmail.com", "yahoo.com"]
for item in isp:
On Wed, 08 Apr 2009 12:11:55 +0200, Ulrich Eckhardt
wrote:
>find() returns the index where it is found or -1 if it is not found. Both an
>index>0 or a -1 evaluate to True when used as conditional expression.
Thanks everyone. I shouldn't have assumed that "if test.find(item):"
was necessarily enou
Hello
I stumbled upon something funny while downloading web pages and
trying to extract one or more blocks from a page: Even though Python
seems to return at least one block, it doesn't actually enter the for
loop:
==
re_block = re.compile('before (.+?) after',re.I|re.S|re.M)
#Here,
Hello
Until now, the modest web apps I wrote were all in PHP because it's
available on just about any hosted server.
I now have a couple of ideas for applications where I would deploy my
own servers, so that I'd rather write them in Python because I find
the language more pleasant to writ
Hello
According to Google, there seems to be several tools available,
possibly deprecated, to download data from web pages by POSTing forms
and save cookies to maintain state.
I need to write a script under Windows with ActivePython 2.5.1.1 that
would do this:
1. Connect through a local
On Sun, 1 Jun 2008 06:00:03 -0700 (PDT), Mike Driscoll
<[EMAIL PROTECTED]> wrote:
>I recall that there is an advanced calendar widget that's been made by
>one of the regulars on the wxPython list, but it's not a part of the
>official distribution at this time. You'll have to ask about calendar
>wid
On Sun, 1 Jun 2008 21:59:29 +0900, "Ryan Ginstrom"
<[EMAIL PROTECTED]> wrote:
>wxPython can be made to look pretty nice. Check out Chandler for an example.
>http://chandlerproject.org/
Yup, they developped some nice-looking widgets, but it doesn't seem
like there's an ecosystem around wxWidgets. I
On Sun, 1 Jun 2008 21:27:30 +0900, "Ryan Ginstrom"
<[EMAIL PROTECTED]> wrote:
>For your stated needs, I'd advise checking out IronPython or Python.NET
>(which allow use of .NET GUI libraries).
Thanks but I forgot to say that I'd rather not use .Net because
deployment/updates are too problematic fo
Hello
Since Python is such a productive language, I'd really like to be
able to use it to write GUI apps for Windows, but business apps
require rich widgets like (DB)grids, calendars, etc.
The ones available in wxWidgets looked a bit too basic compared to
what's available for eg. Delphi o
On Sun, 01 Jun 2008 11:24:17 -0400, [EMAIL PROTECTED] wrote:
>Instead of the COM approach, have you considered using a local, client
>based Python server as a container for your business logic and GUI
>(DHTML, AJAX)?
But web-based apps are even worse, since the set of widgets is even
more basic, a
On Mon, 2 Jun 2008 12:06:21 -0700 (PDT), Matimus <[EMAIL PROTECTED]>
wrote:
>Here is a brief example. Note that this code is very insecure and
>susceptible to a SQL injection attack. Hopefully these csv files are
>from a trusted source.
Yes they are, and this script will only run on my PC, so it d
On Mon, 02 Jun 2008 17:49:11 -0700, Scott David Daniels
<[EMAIL PROTECTED]> wrote:
>(c, "NULL") is a tuple; it is being indexed by the boolean "c == ''"
>Since False is 0, and True is 1, the expression picks out "NULL"
>exactly when c is the zero-length string.
Thanks Scott, and also to Peter abo
On Sun, 15 Jun 2008 18:15:38 -0700, Dennis Lee Bieber
<[EMAIL PROTECTED]> wrote:
> I don't know quite what the reason for the sql = sql + ... is -- if
>you are trying to package more than one discrete statement into a single
>query you should be advised that not all adapters/DBMS support that
Hello
It seems like I have Unicode data in a CSV file but Python is using
a different code page, so isn't happy when I'm trying to read and put
this data into an SQLite database with APSW:
sql = "INSERT INTO mytable (col1,col2) VALUES (?,?)"
cursor.executemany(sql, records("test.
On Tue, 17 Jun 2008 09:23:28 +0200, Peter Otten <[EMAIL PROTECTED]>
wrote:
> Assuming that encoding is UTF-8 and that apsw can cope
> with unicode, try to convert your data to unicode before
> feeding it to the database api:
>
>> sql = "INSERT INTO mytable (col1,col2) VALUES (?,?)"
>
> rows = ([co
On Mon, 31 Mar 2008 11:01:19 +0100, "Moynes James"
<[EMAIL PROTECTED]> wrote:
>In the script below I have added two panels to a frame. I want to
>display the grid in one panel (and later on add other widgets to the
>other panel), but I cannot get the grid to display properly.
I'm learning wxPython
Hello
Out of curiosity, if I recompile a Python (wxPython) app with
py2exe, can I have customers just download the latest .exe, or are
there dependencies that require downloading the whole thing again?
FWIW, here's the list of files that were created after running py2exe:
myprog.exe
bz2.
Hello
I use a dictionary to keep a list of users connected to a web site.
To avoid users from creating login names that start with digits in
order to be listed at the top, I'd like to sort the list differently
every minute so that it'll start with the next letter, eg. display the
list from A...Zd
On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault
wrote:
>I see that dictionaries can be sorted using the... sort() method, but
>is it possible to have Python start sorting from a different letter?
Looks like the solution is to read the list of keys into a list, sort
the list, and then us
On 22 Jan 2010 13:35:26 GMT, Neil Cerutti wrote:
>Resorting is more work than is needed. Just choose a different
>starting index each time you display the names, and set up your
>lister to wrap-around to your arbitrary starting index.
Thanks. In this case, it means that in each loop iteration, I
On Fri, 22 Jan 2010 14:09:43 +0100, Jean-Michel Pichavant
wrote:
>Sorry, the code I provided produce this output:
>
>['1a', 'a', 'ac', 'av', 'b', 'c']
>['a', 'ac', 'av', 'b', 'c', '1a']
>['b', 'c', '1a', 'a', 'ac', 'av']
>['c', '1a', 'a', 'ac', 'av', 'b']
>['1a', 'a', 'ac', 'av', 'b', 'c']
>
>whic
On Fri, 22 Jan 2010 09:49:32 -0500, Dave Angel wrote:
>Seems to me the other solutions I've seen so far are more complex than
>needed. I figure you either want an unordered list, in which case you
>could use random.shuffle(), or you want a list that's sorted, but starts
>somewhere in the middl
On 22 Jan 2010 15:24:58 GMT, Duncan Booth
wrote:
>Here's another:
Thanks for the sample. It work great, except that it also runs when
the header character doesn't match any item in the list:
===
import bisect
connected = []
connected.append("_test")
connected.append("-test")
connected.appen
On Fri, 22 Jan 2010 17:21:02 +0100, Jean-Michel Pichavant
wrote:
>Ok I realized that picking up a random index prevent from grouping names
>starting with the same letter (to ease visual lookup).
>Then go for the random char, and use char comparison (my first example).
Yup, I think it's a good en
On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault
wrote:
>To avoid users from creating login names that start with digits in
>order to be listed at the top, I'd like to sort the list differently
>every minute so that it'll start with the next letter, eg. display the
>lis
Hello
I recently asked how to pull companies' ID from an SQLite database,
have multiple instances of a Python script download each company's web
page from a remote server, eg. www.acme.com/company.php?id=1, and use
regexes to extract some information from each page.
I need to run multiple
Hello
I'm reading O'Reily's "Python Programming on Win32", but couldn't find
a simple example on how to create a window with just a label and
pushbutton.
If someone has such a basic example handy, I'm interested.
Thank you.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
For a game, I need to go through a wordlist, and for each word,
compute its value, ie. a=1, b=2, etc.
So for instance, NewYork = 14 + 5 + 23 + 25 + 15 + 18 + 11 = 111.
Before I write the obvious While loop to go through each line in the
input text file, I was wondering if Python didn't al
On Wed, 16 Feb 2011 01:27:06 -0800, Chris Rebert
wrote:
>A = ord('a') - 1
>for line in your_file:
>word = line.strip().lower()
>score = sum(ord(letter)-A for letter in word)
Thanks much Chris.
--
http://mail.python.org/mailman/listinfo/python-list
Hello
I'm using ActivePython 2.5.1 and the cookielib package to retrieve web
pages.
I'd like to display a given cookie from the cookiejar instead of the
whole thing:
#OK
for index, cookie in enumerate(cj):
print index, ' : ', cookie
#How to display just PHPSESSID?
Hello
I'd like to make sure I understand what the options are to write web
applications in Python:
- à la PHP, using Apache's mod_python
- using eg. Lighttpd and configuring it to load the Python interpreter
every time a Python script is called (www.jakehilton.com/?q=node/54)
- long-running pro
On Mon, 12 Apr 2010 12:13:17 +0200, Daniel Fetchinson
wrote:
>For additional info have a look at http://wiki.python.org/moin/WebProgramming
Thanks for the link.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 12 Apr 2010 05:37:54 -0700 (PDT), Luis M. González
wrote:
>You should first investigate the different python web frameworks,
>choose one and then use the deployment options supported by your
>choice. These frameworks support several ways to deploy your apps,
>such as those you mentioned.
On Thu, 15 Apr 2010 12:41:56 +0200, Bruno Desthuilliers
wrote:
>The PHP execution model (mostly based on CGI FWIW) tends to be a bit
>unpractical for non-trivial applications since you have to rebuild the
>whole world for each and any incoming request, while with a long-running
>process, you lo
Hello
I'd like to build a prototype that will combine a web server as
front-end (it must support GZIPping data to the remote client when
there are a lot of data to return), and SQLite as back-end, call the
server from a VB.Net application, and see how well this works. I want
to see if performance
On Mon, 03 May 2010 11:51:41 +0200, Helmut Jarausch
wrote:
>http://www.karrigell.fr/doc/
Thanks for the tip.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 3 May 2010 23:07:08 -0700 (PDT), Bryan
wrote:
>I love SQLite because it solves problems I actually have. For the vast
>majority of code I write, "lite" is a good thing, and lite as it is,
>SQLite can handle several transactions per second. I give SQLite a
>file path and in a split second I
Hello
I'd like to write a small web app in Python which must include a
forum.
So I checked the relevant article in Wikipedia, which says that only
one forum app is available for Python:
http://en.wikipedia.org/wiki/Comparison_of_internet_forum_software_(other)
Is Pocoo really the only solution
On Sat, 10 Jul 2010 18:37:00 +0200, Bruno Desthuilliers
wrote:
>There are almost a dozen of Python "forum apps" for Django alone, and
>Python is known as "the language with more web frameworks than keywords".
Thanks for the tip. I'll head that way.
--
http://mail.python.org/mailman/listinfo/pyth
On Sat, 10 Jul 2010 18:37:00 +0200, Bruno Desthuilliers
wrote:
>There are almost a dozen of Python "forum apps" for Django alone, and
>Python is known as "the language with more web frameworks than keywords".
So this list at Wikipedia is out-of-date/wrong, and there are more
options through web f
Hello
I just got a small appliance based on a Blackfin CPU with 64MB RAM and
258MB NAND flash. Using the stock software, there's about 30MB of RAM
left.
Besides C/C++ and shel scripts, I was wondering if it were realistic
to upload a few Python scripts in such a small appliance?
Thank you.
--
h
Hello,
I need to convert DD MM dates into the MySQL-friendly
-MM-DD, and translate the month name from literal French to its
numeric equivalent (eg. "Janvier" into "01").
Here's an example:
SELECT dateinscription, dateconnexion FROM membres LIMIT 1;
26 Mai 2007|17 Août 2009 - 09
Thanks everyone for the help. This script is just a one-shot thingie
on my work host, not as a web script or anything professional.
On Mon, 17 Aug 2009 17:05:28 -0700 (PDT), Jonathan Gardner
wrote:
>Unfortunately, there isn't any string to date parsers in the built-
>ins. Not to worry, though, si
On Tue, 18 Aug 2009 17:10:50 +1000, Ben Finney
wrote:
>Luckily, you have access to the documentation to find out.
I never used groups before. Thanks for showing me.
At this point, the script is almost done, but the regex fails if the
month contains accented characters (eg. "Août", but fine if e
On Tue, 18 Aug 2009 01:11:20 -0700, Rami Chowdhury
wrote:
>Could you let me know which platform this is on (Windows, *nix)? It may be a
>locale encoding issue -- the locale.setlocale() function allows the second
>argument to be a tuple of (locale_code, encoding), as below:
>
>locale.setlocale(lo
On Tue, 18 Aug 2009 10:52:41 +0200, Gilles Ganault
wrote:
>I find it odd that the regex library can't handle European characters
>:-/
Ha, found it! :-)
http://www.regular-expressions.info/python.html
=
# -*- coding: latin-1 -*-
import locale
import re
locale.setlocale(lo
On Tue, 18 Aug 2009 20:03:47 +1000, Ben Finney
wrote:
>The principles of handling text in Python: Get it to internal Unicode
>objects as soon as possible, handle it as Unicode for as long as
>possible, and only encode it to some byte stream for output as late as
>possible.
Thanks much for the tip
I find it odd that the regex library can't handle European characters
:-/
--
http://mail.python.org/mailman/listinfo/python-list
Hello
I was wondering if some people in this ng use Python and some GUI
toolkit (PyWin32, wxWidgets, QT, etc.) to build professional
applications, and if yes, what it's like, the pros and cons, etc.
I'm especially concerned about the lack of controls, the lack of
updates (lots of controls
On Tue, 25 Aug 2009 13:24:39 +0200, Wolfgang Keller
wrote:
>The area of _desktop_ database application development indeed looks like a
>vast and very hostile desert in the Python landscape.
>
>The only framework that seems to be worth trying is Dabo. Unfortunately
>there's little documentation,
Hello
I have a working Python script that SELECTs rows from a database to
fetch a company's name from a web-based database.
Since this list is quite big and the site is the bottleneck, I'd like
to run multiple instances of this script, and figured a solution would
be to pick rows at rando
On Mon, 21 Sep 2009 21:40:02 -0700, Dennis Lee Bieber
wrote:
> I'd suggest either a pool of threads -- 5-10, each reading company
>names from a shared QUEUE, which is populated by the main thread
>(remember to commit() so that you don't block on database updates by the
>threads). OR... deter
Hi,
I'd consider using zip :
>>> array1 = ['one','two','three','four']
>>> array2 = ['a','b','c','d']
>>> zip(array1, array2)
[('one', 'a'), ('two', 'b'), ('three', 'c'), ('four', 'd')]
>>> for one, two in zip(array1, array2):
... print one, two
...
one a
two b
three c
four d
>>>
HTH,
Quenti
On Jan 17, 2008 2:38 PM, Sacred Heart <[EMAIL PROTECTED]> wrote:
> On Jan 17, 1:35 pm, [EMAIL PROTECTED] wrote:
> > for i in zip(array1, array2):
> > print i
> >
> > Although I take it you meant four d, the issue with this method is
> > that once you hit the end of one array the rest of the ot
If the data becomes much bigger, change your way of storing it, not the
code. You don't want to code hundreds of "if - elif - else" because you have
hundreds of different data, right ? TheDailyWTF is full of horror stories
like this, by the way ;-)
Data growth shouldn't result in modification in lo
Hi Steve,
Considering this is a Python list, I doubt you'll get much help for
something related to Netbeans and Ruby.
You're better off asking questions on the proper list :
http://www.netbeans.org/community/lists/
Quentin
On Sun, Feb 24, 2008 at 12:26 PM, Steve <[EMAIL PROTECTED]> wrote:
> Hi
*Literal* string concatenation has always been a part of Python :
http://docs.python.org/reference/lexical_analysis.html#string-literal-concatenation
On Wed, Feb 11, 2009 at 12:06 PM, c d saunter <
christopher.saun...@durham.ac.uk> wrote:
> I did a double take when debugging an error the other d
On Mon, Jan 5, 2009 at 5:34 PM, Bruno Desthuilliers
wrote:
> guss a écrit :
>
>> I cannot find a satisfying answer to this question on the web so let's
>> try here.
>>
>> My problem is the following, I would like to instantiate some object
>> from a configuration file that would contain class nam
I personally don't see any benefit in this approach. By definition,
unittests should be independent, so the order argument suggests a deeper
issue. What's your use case ?
Quentin
On Fri, May 23, 2008 at 11:36 AM, Antoon Pardon <[EMAIL PROTECTED]>
wrote:
> Some time ago I asked whether is would
I don't want to spoil the fun, so I'll just say that "range" is the key
here.
Quentin
On Thu, Jun 5, 2008 at 3:43 PM, garywood <[EMAIL PROTECTED]> wrote:
> Hi there. So I have a challenge in the Python book I am using (python
> programming for the absolute beginner) that tells me to improve an
Actually, since you want to keep the missing words apart from the found
ones, it's not necessary to do that. Using "first_char" and "missing_word"
(quoting Peter's code) as lists instead of strings comes to mind, then you
can join both lists into a string once the code exits the for loop.
Cheers,
201 - 273 of 273 matches
Mail list logo