SimpleHTTPServer, external CSS, and Google Chrome

2010-09-17 Thread Justin Ezequiel
I am running python -m SimpleHTTPServer 80 on Windows XP Pro SP 3
(Python 2.5.4)

browsing http://localhost/ using IE8 and FireFox 3.6, I get blue text
on red background
on Google Chrome 6.0 however, I get blue text on white background
placing index.htm and styles.css (see below) under IIS, I get blue
text on red background for all browsers,
including Google Chrome 6.0.

I get exactly the same results when browsing from another machine.
what's wrong? what do I need to change in SimpleHTTPServer?

index.htm
--
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN
   http://www.w3.org/TR/html4/strict.dtd;
html
head
titleyour title/title
meta http-equiv=Content-Type content=text/
html;charset=ISO-8859-1
link rel=stylesheet href=styles.css type=text/css
style type=text/css
body {
color: blue;
}
/style
/head
bodypfoo bar/p
/body
/html
--

styles.css
--
body {
background-color: red;
}
--
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: data structure suggestion (native python datatypes or sqlite; compound select)

2010-09-17 Thread Vlastimil Brom
2010/9/17 MRAB pyt...@mrabarnett.plus.com:
 On 17/09/2010 00:56, Vlastimil Brom wrote:

 2010/9/17 MRABpyt...@mrabarnett.plus.com:

 On 16/09/2010 23:11, Vlastimil Brom wrote:

 ...
 I put together some code, which works as expected, but I suspect
 somehow, that there must be better ways of doing it.

 Two things I am not quite clear about are using the placeholders for
 the data identifiers and chaining the SELECT parameters.

 I Couldn't find a way to use ? placeholder for table or column
 names, hence I ended up using string interpolation for them and
 placeholders for the data values, like.
 curs.execute('SELECT * FROM %s WHERE %s==?' % (text_name,
 index_col), (text_index,))
 is there a better way or is it not supposed to supply these
 identifiers programatically?

 You would normally expect the structure of the database to be fixed and
 only the contents to vary.

 For getting the matching text indices given the tags, tag_values
 combination I ended up with a clumsy query:

 combined_query_list = ['SELECT %s FROM %s WHERE %s==?' %
 (index_col, text_name, tag) for tag in tags]
 sql_query =  INTERSECT .join(combined_query_list)
 curs.execute(sql_query, tag_values)

 which produces e.g.:
 SELECT ind FROM n WHERE KC==? INTERSECT SELECT ind FROM n
 WHERE VN==?

 or alternatively:

 select_begin = 'SELECT %s FROM %s WHERE ' % (index_col, text_name)
 where_subquery =  AND .join('%s==?' % (tag,) for tag in tags)
 sql_query = select_begin + where_subquery

 with the resulting query string like:
 SELECT ind FROM n WHERE KC==? AND VN==? ('12', '1')

 (BTW, are these queries equivalent, as the outputs suggest, or are
 there some distinctions to be aware of?)

 Anyway, I can't really believe, this would be the expected way ...

 If you're selecting rows of a table then using 'AND' would seem the
 obvious way.


 Thanks for the answer,
 Well, that may be a part of the problem, the database structure is
 going to be fixed once I'll have the text sources complete, but I was
 trying to keep it more general, also allowing the identifiers to be
 passed programmatically (based on the tagged text in question).

 yes, I am just selecting rows - based on the combination of the column
 values (which, I guess, might be an usual database approach(?).
 However, I was unsure, whether it is usual to construct the query
 string this way - partly using string interpolation or sequence
 joining.
 Or should there normally be no need for construct like the above and I
 am doing something wrong in a more general sense?

 In general you'd have a fixed database structure and fixed queries.
 You'd design it so that you wouldn't have different columns for
 different tagged texts, forcing you to change the database structure
 when texts were added or removed, but no-one will come around to your
 house to stop you creating queries dynamically. :-)
 --
 http://mail.python.org/mailman/listinfo/python-list

Ok, thanks for confirming my suspicion :-),
Now I have to decide whether I shall use my custom data structure,
where I am on my own, or whether using an sql database in such a
non-standard way has some advantages...
The main problem indeed seems to be the fact, that I consider the
tagged texts to be the primary storage format, whereas the database is
only means for accessing it more conveniently.

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


Re: Embedded Systems development using Python

2010-09-17 Thread VGNU Linux
Hi All,
Appreciate your response.
Now I am going to use Telit Module GE865-QUAD with support for GPS and GPRS
capabilities.
It also has built-in python interpreter for developing application for the
module.
But still I have no idea which microprocessor/microcontroller to use.
Can anyone help me out here ? Is there any microprocessor/microcontroller
which I could use with Python and Telit module?
Any help here will be appreciated.

Regards,
VGNU

On Mon, Sep 6, 2010 at 8:54 PM, Grant Edwards inva...@invalid.invalidwrote:

 On 2010-09-06, Stefan Behnel stefan...@behnel.de wrote:
  VGNU Linux, 06.09.2010 13:02:
  Can Python be used for embedded systems development ?
 
  It can and has been.
 
  What kind of embedded system with what set of capabilities are you
 thinking
  about? TV sets? Mobile phones? Smart dust?

 [The OP never showed up on my sever for some reason]

 If you google for deeply embedded python, you'll find some raterh
 old links:

  http://tucs.fi/magazin/output.php?ID=2000.N2.LilDeEmPy

 http://groups.google.com/group/python-on-a-chip/web/list-of-small-python-implementations

 http://mail.python.org/pipermail/python-announce-list/1999-August/000157.html

 A few years ago I used Python on a prototype for a bicycle computer
 with GPS, four buttons, and a small LCD screen.  It was more or less
 comparable to a PDA with Linux running on an 200MHz XScale with
 something like 16MB of flash and 32MB of SDRAM.

 IIRC, that project used OpenEmbedded, and all I had to do was build
 the Python package that's already there in OE.  I don't remember if I
 was using PySDL or PyQt for the UI -- I remember experimenting with
 both on desktop hosts at the time.

 I don't think that product ever saw daylight.  There was just now way
 they could have competed with Garmin.

 --
 Grant

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

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


Re: program organization question for web development with python

2010-09-17 Thread Bruno Desthuilliers

Hans a écrit :
(snip)


Maybe I did not make my question clear. I never tried python web
programing before, so I want to start from CGI.


You can indeed learn quite a few things doing raw CGI - the most 
important one being why frameworks are a good idea !-)



I read something about web framework like django, but seems it's a
little bit complicated.


Not that much IMHO, but being an early django user I'm probably a bit 
biased. Now Python is known as the language with more web frameworks 
than keywords, so you could probably check some lighter framework like 
 web.py (http://webpy.org/) or flask (http://flask.pocoo.org/).



my task is actually very simple: get search
string from input, and then search database, print search result. I
thought CGI should be good enough to do this.


CGI is good enough to do any web stuff - just like assembler is good 
enough to write any application !-)



I don't have any idea about how to organize those cgi codes, so what
I'm asking is:

1. do I have to have each single file for each hyper-link? Can I put
them together? how?



2. how can I pass a db_cursor to another file?   can I use db_cursor as
a parameter?


Obviously not. FWIW, both questions show a lack of understanding of the 
HTTP protocol, and you can't hope to do anything good in web programming 
if you don't understand at least the basics of the HTTP protocol, 
specially the request/response cycle.


Now for a couple more practical answers:

There are basically two ways to organize your url = code mapping:
1/ have only one cgi script and use querystring params to tell which 
action should be executed.

2/ have one cgi script per action.

The choice is up to you. For a simple app like yours, the first solution 
is probably the most obvious : always display the seach form, if the 
user submitted the form also display the result list. That's how google 
works (wrt/ user interface I mean).


Now if you still need / want to have distinct scripts and want to factor 
out some common code, you just put the common code in a module that you 
import from each script.

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


Re: Very stupid question about a % symbol

2010-09-17 Thread Steven D'Aprano
On Thu, 16 Sep 2010 11:25:06 -0400, J wrote:

 OK, this is a very stupid question about a very simple topic, but Google
 is failing me this morning...
[...]

Others have already answered your question, but for future reference, 
many people won't bother to read posts with a meaningless subject line 
like Very stupid question about  

Very stupid questions invite very stupid answers. I guess you can be 
grateful that this Python group is more friendly than the average tech 
group, otherwise you might have got no answers at all, or a sarcastic 
one. Besides, your actual question isn't stupid at all. It is a sensible, 
although basic, question.

A better subject line would have been:

How to insert percent sign in % format strings?

or some variation thereof. This will also be of benefit to others, who 
some day may be Googling for the answer to the same question.


Regards,



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


Re: Very stupid question about a % symbol

2010-09-17 Thread Xavier Ho
On 17 September 2010 12:48, Terry Reedy tjre...@udel.edu wrote:

 Doubling an escape char, whatever it is, is a common convention:
  print(Print a {{}} format string line this: {{{}}}.format(2))
 Print a {} format string line this: {2}


Wow. That's convoluted. Took me a minute to process.

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


Re: compile Py2.6 on SL

2010-09-17 Thread Michel Claveau - MVP
Hello!

SL (SilverLight) is a library/techno who give functions.
You cannot compile Python on SL (SilverLight).

@-salutations
-- 
Michel Claveau 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: compile Py2.6 on SL

2010-09-17 Thread Jason Swails
On Fri, Sep 17, 2010 at 7:21 AM, Michel Claveau - MVP
enleverlesx_xx...@xmclavxeaux.com.invalid wrote:

 Hello!

 SL (SilverLight) is a library/techno who give functions.
 You cannot compile Python on SL (SilverLight).


I think the original thread meant Snow Leopard (the latest Mac OS X)



 @-salutations
 --
 Michel Claveau
 --
 http://mail.python.org/mailman/listinfo/python-list




-- 
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Graduate Student
352-392-4032
-- 
http://mail.python.org/mailman/listinfo/python-list


MySQL Query Problem

2010-09-17 Thread Victor Subervi
Hi;
I have this code:

cursor.execute('insert into Passengers values (Null, %s, %s, %s, %s,
%s, %s, %s, %s, no, n/a)', (curr_flight, curr_customer, name, curr_sex,
curr_weight, price, curr_rt, curr_confirmation))

Now, when I print it out, add quotes where necessary and enter it in at a
mysql prompt, all goes well. But when I do it this way, it enters null
values for curr_customer and curr_weight! Same darn thing printed out works
at the prompt. What gives?
TIA,
beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQL Query Problem

2010-09-17 Thread Victor Subervi
Here's some more data:

print 'insert into Passengers values (Null, %s, %s, %s, %s, %s, %s,
%s, %s, no, n/a)' % (curr_flight, curr_customer, name, curr_sex,
curr_weight, price, curr_rt, curr_confirmation)
cursor.execute('insert into Passengers values (Null, %s, %s, %s, %s,
%s, %s, %s, %s, no, n/a)', (curr_flight, curr_customer, name, curr_sex,
curr_weight, price, curr_rt, curr_confirmation))
database.commit()
cursor.execute('select last_insert_id() from Passengers')
last_insert_id = cursor.fetchone()[0]
print 'update Passengers set name=%s, weight=%s where id=%s' %
(name, curr_weight, last_insert_id)
cursor.execute('update Passengers set name=%s, weight=%s where
id=%s', (name, curr_weight, last_insert_id))
database.commit()

This prints out:

insert into Passengers values (Null, 1, 1, Dr. Mengela, Male, 155, 100, 100,
654, no, n/a)
update Passengers set name=Dr. Mengela, weight=155 where id=15

Here's what's in the database:

mysql select * from Passengers;
+++-+--+--++---++--+--+---+
| id | flights_id | customer_id | name | sex  | weight | price | round_trip
| confirmation | late_fee | late_fee_paid |
+++-+--+--++---++--+--+---+
|  1 |  1 |   1 | ''   | NULL |   NULL |  0.00 |  0
| 12345| NULL | NULL  |
| 15 |  1 |   1 | ''   | Male |   NULL |  0.00 |100
| 654  | no   | n/a   |
+++-+--+--++---++--+--+---+
2 rows in set (0.00 sec)

mysql describe Passengers;
+---+---+--+-+-++
| Field | Type  | Null | Key | Default |
Extra  |
+---+---+--+-+-++
| id| int(11)   | NO   | PRI | NULL|
auto_increment |
| flights_id| int(11)   | NO   | MUL | NULL
||
| customer_id   | int(11)   | NO   | MUL | NULL
||
| name  | varchar(40)   | YES  | | NULL
||
| sex   | enum('Male','Female') | YES  | | NULL
||
| weight| int(11)   | YES  | | NULL
||
| price | float(6,2)| NO   | | NULL
||
| round_trip| tinyint(1)| NO   | | 1
||
| confirmation  | varchar(20)   | YES  | | NULL
||
| late_fee  | enum('no','yes')  | YES  | | no
||
| late_fee_paid | enum('n/a','paid','not paid') | YES  | | n/a
||
+---+---+--+-+-++
11 rows in set (0.00 sec)

and when I run the update:

mysql select * from Passengers;
+++-+-+--++---++--+--+---+
| id | flights_id | customer_id | name| sex  | weight | price |
round_trip | confirmation | late_fee | late_fee_paid |
+++-+-+--++---++--+--+---+
|  1 |  1 |   1 | ''  | NULL |   NULL |  0.00
|  0 | 12345| NULL | NULL  |
| 15 |  1 |   1 | Dr. Mengela | Male |155 |  0.00
|100 | 654  | no   | n/a   |
+++-+-+--++---++--+--+---+
2 rows in set (0.00 sec)

Please explain why it does that!
TIA,
beno

On Fri, Sep 17, 2010 at 8:51 AM, Victor Subervi victorsube...@gmail.comwrote:

 Hi;
 I have this code:

 cursor.execute('insert into Passengers values (Null, %s, %s, %s,
 %s, %s, %s, %s, %s, no, n/a)', (curr_flight, curr_customer, name,
 curr_sex, curr_weight, price, curr_rt, curr_confirmation))

 Now, when I print it out, add quotes where necessary and enter it in at a
 mysql prompt, all goes well. But when I do it this way, it enters null
 values for curr_customer and curr_weight! Same darn thing printed out works
 at the prompt. What gives?
 TIA,
 beno

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


Re: Too many threads

2010-09-17 Thread mark . pelletier
On Sep 17, 1:38 am, Ned Deily n...@acm.org wrote:
 In article 20100917052259.ga28...@cskk.homeip.net,
  Cameron Simpson c...@zip.com.au wrote:





  On 16Sep2010 22:14, Ned Deily n...@acm.org wrote:
  | In article 20100917043826.ga21...@cskk.homeip.net,
  |  Cameron Simpson c...@zip.com.au wrote:
  |
  |  On 16Sep2010 09:55, mark.pellet...@asrcms.com 
  mark.pellet...@asrcms.com
  |  wrote:
  |  | For some reason, the tasks I put into my thread pool occasionally get
  |  | run more than once.
  |  |
  |  | Here's the code:
  | 
  |  You need to post your _exact_ code. I had to change:
  |    from queue import Queue
  |  into
  |    from Queue import Queue
  |  So: _do_ you have a queue (lowercase) module? Is it buggy?
  |
  | The OP is probably using Python 3.

  Ah, that explains the print(). Anyone know if print() is thread safe in
  python 3?

 I vaguely recalled a similar problem and, on the second try, found it:

 http://bugs.python.org/issue6750

 Looks like that fix should have been in Python 3.1.2.

 --
  Ned Deily,
  n...@acm.org- Hide quoted text -

 - Show quoted text -

I was a little surprised at my problems, as I cribbed the code from

http://docs.python.org/py3k/library/queue.html?highlight=queue#queue.Queue.put

But in the end, yeah it does look like a thread-safe problem with
print.  I tried replacing the print statement by using another queue,
and it worked just fine.  Glad to know that it's fixed in 3.1.2; of
course, I am running 3.1.1.  Doesn't matter, the print statement was
just for demonstration purposes.  I'm actually going to put a
subprocess.getoutput() there.  Wonder if that's thread safe?

Thanks, Cameron and Ned
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WMI in Python

2010-09-17 Thread alex23
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
 Because machine-generated
 code has no place in a source file to be maintained by a human.

Endlessly repeating your bigotry doesn't make it any more true.
-- 
http://mail.python.org/mailman/listinfo/python-list


Compiling SWIG Extensions With VC2008 and VC2010 Both Installed

2010-09-17 Thread ElMariachi

I am attempting to compile a SWIG extension library for QuantLib
(www.quantlib.org) on Windows 7 running Python 2.6. 

2.6 needs VC2008 to compile extensions yet distutils cannot find this
version, is there a way I can specify that this version be used? Currently,
when I attempt a build, I get a lot of the following errors:

python setup.py build 
running build 
running build_py 
running build_ext 
building 'QuantLib._QuantLib' extension 
C:\Python26\Scripts\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python26\include
-IC:\Python26\PC -c QuantLib/quantlib_wrap.cpp -o build 
QuantLib/quantlib_wrap.cpp:3423:26: ql/version.hpp: No such file or
directory 
QuantLib/quantlib_wrap.cpp:3424: error: `QL_HEX_VERSION' was not declared in
this scope 
QuantLib/quantlib_wrap.cpp:3425: error: `QL_VERSION' was not declared in
this scope 
QuantLib/quantlib_wrap.cpp:3484:27: ql/quantlib.hpp: No such file or
directory 
QuantLib/quantlib_wrap.cpp:3487:6: #error using an old version of QuantLib,
please update 
QuantLib/quantlib_wrap.cpp:3874:48: boost/algorithm/string/case_conv.hpp: No
such file or directory 
QuantLib/quantlib_wrap.cpp:3878: error: `QuantLib' has not been declared 
QuantLib/quantlib_wrap.cpp:3878: error: expected nested-name-specifier
before Error 
QuantLib/quantlib_wrap.cpp:3878: error: `Error' has not been declared 
QuantLib/quantlib_wrap.cpp:3879: error: `QuantLib' has not been declared 
QuantLib/quantlib_wrap.cpp:3879: error: expected nested-name-specifier
before Handle 
QuantLib/quantlib_wrap.cpp:3879: error: `Handle' has not been declared 
QuantLib/quantlib_wrap.cpp:3880: error: `QuantLib' has not been declared 
QuantLib/quantlib_wrap.cpp:3880: error: expected nested-name-specifier
before RelinkableHandle 
QuantLib/quantlib_wrap.cpp:3880: error: `RelinkableHandle' has not been
declared 
QuantLib/quantlib_wrap.cpp:3883: error: `QuantLib' has not been declared 
QuantLib/quantlib_wrap.cpp:3883: error: expected nested-name-specifier
before Integer 
QuantLib/quantlib_wrap.cpp:3883: error: `Integer' has not been declared 
QuantLib/quantlib_wrap.cpp:3884: error: `QuantLib' has not been declared 
QuantLib/quantlib_wrap.cpp:3884: error: expected nested-name-specifier
before BigInteger 
QuantLib/quantlib_wrap.cpp:3884: error: `BigInteger' has not been declared
-- 
View this message in context: 
http://old.nabble.com/Compiling-SWIG-Extensions-With-VC2008-and-VC2010-Both-Installed-tp29739343p29739343.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Re: MySQL Query Problem

2010-09-17 Thread Victor Subervi
I rebooted MySQL and it now works fine ;)

On Fri, Sep 17, 2010 at 9:26 AM, Victor Subervi victorsube...@gmail.comwrote:

 Here's some more data:

 print 'insert into Passengers values (Null, %s, %s, %s, %s, %s, %s,
 %s, %s, no, n/a)' % (curr_flight, curr_customer, name, curr_sex,
 curr_weight, price, curr_rt, curr_confirmation)

 cursor.execute('insert into Passengers values (Null, %s, %s, %s,
 %s, %s, %s, %s, %s, no, n/a)', (curr_flight, curr_customer, name,
 curr_sex, curr_weight, price, curr_rt, curr_confirmation))
 database.commit()
 cursor.execute('select last_insert_id() from Passengers')
 last_insert_id = cursor.fetchone()[0]
 print 'update Passengers set name=%s, weight=%s where id=%s' %
 (name, curr_weight, last_insert_id)
 cursor.execute('update Passengers set name=%s, weight=%s where
 id=%s', (name, curr_weight, last_insert_id))
 database.commit()

 This prints out:

 insert into Passengers values (Null, 1, 1, Dr. Mengela, Male, 155, 100,
 100, 654, no, n/a)
 update Passengers set name=Dr. Mengela, weight=155 where id=15

 Here's what's in the database:

 mysql select * from Passengers;

 +++-+--+--++---++--+--+---+
 | id | flights_id | customer_id | name | sex  | weight | price | round_trip
 | confirmation | late_fee | late_fee_paid |

 +++-+--+--++---++--+--+---+
 |  1 |  1 |   1 | ''   | NULL |   NULL |  0.00 |  0
 | 12345| NULL | NULL  |
 | 15 |  1 |   1 | ''   | Male |   NULL |  0.00 |100
 | 654  | no   | n/a   |

 +++-+--+--++---++--+--+---+
 2 rows in set (0.00 sec)

 mysql describe Passengers;

 +---+---+--+-+-++
 | Field | Type  | Null | Key | Default |
 Extra  |

 +---+---+--+-+-++
 | id| int(11)   | NO   | PRI | NULL|
 auto_increment |
 | flights_id| int(11)   | NO   | MUL | NULL
 ||
 | customer_id   | int(11)   | NO   | MUL | NULL
 ||
 | name  | varchar(40)   | YES  | | NULL
 ||
 | sex   | enum('Male','Female') | YES  | | NULL
 ||
 | weight| int(11)   | YES  | | NULL
 ||
 | price | float(6,2)| NO   | | NULL
 ||
 | round_trip| tinyint(1)| NO   | | 1
 ||
 | confirmation  | varchar(20)   | YES  | | NULL
 ||
 | late_fee  | enum('no','yes')  | YES  | | no
 ||
 | late_fee_paid | enum('n/a','paid','not paid') | YES  | | n/a
 ||

 +---+---+--+-+-++
 11 rows in set (0.00 sec)

 and when I run the update:

 mysql select * from Passengers;

 +++-+-+--++---++--+--+---+
 | id | flights_id | customer_id | name| sex  | weight | price |
 round_trip | confirmation | late_fee | late_fee_paid |

 +++-+-+--++---++--+--+---+
 |  1 |  1 |   1 | ''  | NULL |   NULL |  0.00
 |  0 | 12345| NULL | NULL  |
 | 15 |  1 |   1 | Dr. Mengela | Male |155 |  0.00
 |100 | 654  | no   | n/a   |

 +++-+-+--++---++--+--+---+
 2 rows in set (0.00 sec)

 Please explain why it does that!
 TIA,
 beno


 On Fri, Sep 17, 2010 at 8:51 AM, Victor Subervi 
 victorsube...@gmail.comwrote:

 Hi;
 I have this code:

 cursor.execute('insert into Passengers values (Null, %s, %s, %s,
 %s, %s, %s, %s, %s, no, n/a)', (curr_flight, curr_customer, name,
 curr_sex, curr_weight, price, curr_rt, curr_confirmation))

 Now, when I print it out, add quotes where necessary and enter it in at a
 mysql prompt, all goes well. But when I do it this way, it enters null
 values for curr_customer and curr_weight! Same darn thing printed out works
 at the prompt. What gives?
 TIA,
 beno



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


Re: compile Py2.6 on SL

2010-09-17 Thread Aahz
In article 4c934f3c$0$5417$ba4ac...@reader.news.orange.fr,
Michel Claveau - MVP enleverlesx_xx...@xmclavxeaux.com.invalid wrote:

SL (SilverLight) is a library/techno who give functions.
You cannot compile Python on SL (SilverLight).

SL (Snow Leopard) is a popular platform for Python development.  I
suppose this is another argument against TLAs.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

The volume of a pizza of thickness 'a' and radius 'z' is
given by pi*z*z*a
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQL Query Problem

2010-09-17 Thread MRAB

On 17/09/2010 15:59, Victor Subervi wrote:

I rebooted MySQL and it now works fine ;)


I recommend that you always list the column names explicitly to be on
the safe side:

cursor.execute('insert into Passengers (flights_id, customer_id, 
name, sex , weight, price, round_trip, confirmation, late_fee, 
late_fee_paid) values (%s, %s, %s, %s, %s, %s, %s, %s, no, n/a)', 
(curr_flight, curr_customer, name, curr_sex, curr_weight, price, 
curr_rt, curr_confirmation))


[snip code]
--
http://mail.python.org/mailman/listinfo/python-list


self-closing window with wxPython

2010-09-17 Thread Jabba Laci
Hi,

I'd like to create a simple alarm application that shows an alarm
window. The application should shut down automatically after 5
seconds. The problem is the following:
* If I keep the mouse outside of the window, the application keeps
running. Somehow self.Destroy() is not taken into account.
* If the mouse is over the window and I keep moving it, the window closes.

I'm using Ubuntu Linux with wxPython 2.8. Below you can find what I have so far.

Thanks,

Laszlo

==

class MyThread(threading.Thread):
def __init__(self, parent):
self.parent = parent
threading.Thread.__init__(self)

def run(self):
print time.time()# appears on stdout
time.sleep(5)
print time.time()# appears on stdout

self.parent.Destroy()# ??? doesn't work if the mouse is
outside of the application window

class Alarm(wx.Frame):
def __init__(self, title, *args):
wx.Frame.__init__(self, None, -1, title, pos=(0, 0),
size=(800, 600), *args)

self.sleepThread = MyThread(self)
self.sleepThread.start()

self.Bind(wx.EVT_CLOSE, self.on_close)

def on_close(self, event):
self.Destroy()

==

To call it:

class Main(wx.PySimpleApp):
def OnInit(self):
self.frame = alarm.Alarm(Alarm 0.1)
self.SetTopWindow(self.frame)
self.SetExitOnFrameDelete(True)
self.frame.Show()
return True

a = Main()
a.MainLoop()

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


Configuring logging for Web applications

2010-09-17 Thread Vinay Sajip
For those of you writing web applications and having multiple web
applications in the same Python process, if you are interesting in
using Python logging to write to web-application-specific logs, you
may be interested in this link:

http://plumberjack.blogspot.com/2010/09/configuring-logging-for-web.html

If you have any feedback on that post, please comment on that post
itself rather than here ;-)

Thanks and regards,

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


Re: Debugger - fails to continue with breakpoint set

2010-09-17 Thread Lie Ryan
On 09/16/10 03:38, Ed Greenberg wrote:
 I'm pretty new to Python, but I am really enjoying it as an alternative
 to Perl and PHP.
 
 When I run the debugger [import pdb; pdb.set_trace()] and then do next
 and step, and evaluate variables, etc, when I hit 'c' for continue, we
 go to the end, just fine.
 
 As soon as I set a breakpoint down the line, [b line number] the
 behavior of 'c' changes. Instead of continuing until the breakpoint, or
 until the end, if the breakpoint is hidden by a conditional, the
 debugger starts to treat 'c' as a step (or a next, I'm not sure which.)
 
 This behavior is repeatable and consistent.
 

can you write a test script and post its corresponding gdb session that
demonstrates what you meant?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: The trouble with dynamic attributes.

2010-09-17 Thread Lie Ryan
On 09/17/10 07:46, John Nagle wrote:
There's a tendency to use dynamic attributes in Python when
 trying to encapsulate objects from other systems.  It almost
 works.  But it's usually a headache in the end, and should be
 discouraged.  Here's why.

I personally love them, they makes XML files looks more like python objects.

a
bfoo/b
cbar/c
/a

being able to say:

if a.b == 'foo':
print a.c

is very convenient.

Yes, it doesn't work if the attribute contains special characters that
python doesn't recognize; but you shouldn't use these syntax if that's
the case. And even dict-syntax is not perfect for accessing XML file, e.g.:

a
bfoo/b
bbar/b
/a

should a['b'] be 'foo' or 'bar'?

So, personally I think both attribute-syntax and dict-syntax should
continue; it should be up to the programmer to determine whether the
limitations imposed by these syntaxes are suitable for their need (e.g.
if the programmer knows he would only use alphabet tag name, then
attr-style syntax is fine; and if he knows that there is no duplicate,
then dict-style syntax is fine as well; and if he can't rely on both,
then and only then, he'd be forced to do it the long way)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: it doesn't work ;) [class recursive function]

2010-09-17 Thread MRAB

On 17/09/2010 17:55, Ethan Furman wrote:

MRAB wrote:

On 16/09/2010 00:23, Ethan Furman wrote:


I need some fresh eyes, or better brains, or both!


'next_item' is a generator, but it's just calling itself and discarding
the result. I think it should be yielding the results to its caller.
That fix gives me 7 sections in total.


Thanks, M!

Some further reading on generators has helped clarify the issue for me.
I had forgotten that the initial call to a generator only sets it up,
and then returns the generator function itself, which then needs to be
iterated through.

Thanks for the reminder!

--
~Ethan~

Still early in the morning for me, so just in case I didn't phrase it
well, my thanks are sincere.

PS
My apologies if this shows up twice, I haven't seen my other post yet
and it's been 27 hours.


That's probably because you sent it directly to me.
--
http://mail.python.org/mailman/listinfo/python-list


Re: it doesn't work ;) [class recursive function]

2010-09-17 Thread Ethan Furman

MRAB wrote:

On 17/09/2010 17:55, Ethan Furman wrote:

MRAB wrote:

On 16/09/2010 00:23, Ethan Furman wrote:


PS
My apologies if this shows up twice, I haven't seen my other post yet
and it's been 27 hours.


That's probably because you sent it directly to me.


That would explain it -- like I said, it was still early for me!  :)

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


Re: The trouble with dynamic attributes.

2010-09-17 Thread Ethan Furman

Lie Ryan wrote:
[snip]

And even dict-syntax is not perfect for accessing XML file, e.g.:

a
bfoo/b
bbar/b
/a

should a['b'] be 'foo' or 'bar'?


Attribute style access would also fail in this instance -- how is this 
worked-around?


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


re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Jon Clements
Hi All,

(I reckon this is probably a question for MRAB and is not really
Python specific, but anyhow...)

Absolutely basic example: re.sub(r'(\d+)', r'\1', 'string1')

I've been searching around and I'm sure it'll be obvious when it's
pointed out, but how do I use the above to replace 1 with 11?
Obviously I can't use r'\11' because there is no group 11. I know I
can use a function to do it, but it seems to me there must be a way
without. Can I escape r'\11' somehow so that it's group 1 with a '1'
after it (not group 11).

Cheers,

Jon.

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


recording input/outputs, attributes and parameters of modules

2010-09-17 Thread Jojo Mwe
i would like to track all inputs/output to modules/functions -if a
module  retrieved and used files and run some analysis on them and
produced other files in return, i would like to take not of this. i.e
what i
want is to record all input sand outputs to a module. and also to
record all parameters, attribute vaules used by the same module and
also would like to know how one module calls another whether it
instantiates classes from one module etc

Any help will be highly appreciated..

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


Re: SimpleHTTPServer, external CSS, and Google Chrome

2010-09-17 Thread MrJean1
FWIW,

There is a blue text on a red background in all 4 browsers Google
Chrome 6.0.472.59, Safari 5.0.1 (7533.17.8), FireFox 3.6.9 and IE
6.0.2900.5512 with Python 2.7 serving that page on my Windows XP
SP 3 machine.

/Jean

On Sep 16, 11:59 pm, Justin Ezequiel justin.mailingli...@gmail.com
wrote:
 I am running python -m SimpleHTTPServer 80 on Windows XP Pro SP 3
 (Python 2.5.4)

 browsinghttp://localhost/using IE8 and FireFox 3.6, I get blue text
 on red background
 on Google Chrome 6.0 however, I get blue text on white background
 placing index.htm and styles.css (see below) under IIS, I get blue
 text on red background for all browsers,
 including Google Chrome 6.0.

 I get exactly the same results when browsing from another machine.
 what's wrong? what do I need to change in SimpleHTTPServer?

 index.htm
 --
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN
    http://www.w3.org/TR/html4/strict.dtd;
 html
 head
 titleyour title/title
 meta http-equiv=Content-Type content=text/
 html;charset=ISO-8859-1
 link rel=stylesheet href=styles.css type=text/css
 style type=text/css
 body {
     color: blue;}

 /style
 /head
 bodypfoo bar/p
 /body
 /html
 --

 styles.css
 --
 body {
     background-color: red;}

 --

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


Re: re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread MRAB

On 17/09/2010 19:21, Jon Clements wrote:

Hi All,

(I reckon this is probably a question for MRAB and is not really
Python specific, but anyhow...)

Absolutely basic example: re.sub(r'(\d+)', r'\1', 'string1')

I've been searching around and I'm sure it'll be obvious when it's
pointed out, but how do I use the above to replace 1 with 11?
Obviously I can't use r'\11' because there is no group 11. I know I
can use a function to do it, but it seems to me there must be a way
without. Can I escape r'\11' somehow so that it's group 1 with a '1'
after it (not group 11).


re.sub(r'(\d+)', r'\g1', 'string1')
--
http://mail.python.org/mailman/listinfo/python-list


Re: re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Peter Otten
Jon Clements wrote:

 (I reckon this is probably a question for MRAB and is not really
 Python specific, but anyhow...)
 
 Absolutely basic example: re.sub(r'(\d+)', r'\1', 'string1')
 
 I've been searching around and I'm sure it'll be obvious when it's
 pointed out, but how do I use the above to replace 1 with 11?
 Obviously I can't use r'\11' because there is no group 11. I know I
 can use a function to do it, but it seems to me there must be a way
 without. Can I escape r'\11' somehow so that it's group 1 with a '1'
 after it (not group 11).

Quoting 

http://docs.python.org/library/re.html#re.sub


In addition to character escapes and backreferences as described above, 
\gname will use the substring matched by the group named name, as defined 
by the (?Pname...) syntax. \gnumber uses the corresponding group number; 
\g2 is therefore equivalent to \2, but isn’t ambiguous in a replacement 
such as \g20. \20 would be interpreted as a reference to group 20, not a 
reference to group 2 followed by the literal character '0'. The 
backreference \g0 substitutes in the entire substring matched by the RE.


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


Re: re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Jon Clements
On 17 Sep, 19:59, Peter Otten __pete...@web.de wrote:
 Jon Clements wrote:
  (I reckon this is probably a question for MRAB and is not really
  Python specific, but anyhow...)

  Absolutely basic example: re.sub(r'(\d+)', r'\1', 'string1')

  I've been searching around and I'm sure it'll be obvious when it's
  pointed out, but how do I use the above to replace 1 with 11?
  Obviously I can't use r'\11' because there is no group 11. I know I
  can use a function to do it, but it seems to me there must be a way
  without. Can I escape r'\11' somehow so that it's group 1 with a '1'
  after it (not group 11).

 Quoting

 http://docs.python.org/library/re.html#re.sub

 
 In addition to character escapes and backreferences as described above,
 \gname will use the substring matched by the group named name, as defined
 by the (?Pname...) syntax. \gnumber uses the corresponding group number;
 \g2 is therefore equivalent to \2, but isn’t ambiguous in a replacement
 such as \g20. \20 would be interpreted as a reference to group 20, not a
 reference to group 2 followed by the literal character '0'. The
 backreference \g0 substitutes in the entire substring matched by the RE.
 

 Peter

Thanks Peter and MRAB. I must have been through the docs half a dozen
times and missed that - what a muppet! One of those days I guess...

Cheers,

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


Re: self-closing window with wxPython

2010-09-17 Thread Philip Semanchuk

On Sep 17, 2010, at 12:05 PM, Jabba Laci wrote:

 Hi,
 
 I'd like to create a simple alarm application that shows an alarm
 window. The application should shut down automatically after 5
 seconds. The problem is the following:
 * If I keep the mouse outside of the window, the application keeps
 running. Somehow self.Destroy() is not taken into account.
 * If the mouse is over the window and I keep moving it, the window closes.
 
 I'm using Ubuntu Linux with wxPython 2.8. Below you can find what I have so 
 far.

Hi Laszlo,
It's difficult to help without a complete working example. But I have a few 
suggestions.

1) Why not call self.parent.Close()? It seems a bit more polite than .Destroy().

2) I saw this in the documentation for Destroy() -- Frames and dialogs are not 
destroyed immediately when this function is called -- they are added to a list 
of windows to be deleted on idle time, when all the window's events have been 
processed. That might be consistent with what you're seeing. The window you're 
trying to destroy has no events in its queue. WHen you move the mouse over it, 
the window processes those mouse events and then wx realizes, Hey, this window 
has processed all of its events, and it's on the list of windows to be 
destroyed. I'd better get rid of it. 

If you're interested in experimenting, find a non-mouse way to force that 
window to process an event and I'll bet that would have the same effect as 
moving the mouse over it.

3) Both the wxPython and wxWidgets mailing lists are probably better places to 
ask for help on wxPython.


Good luck
Philip



 
 ==
 
 class MyThread(threading.Thread):
def __init__(self, parent):
self.parent = parent
threading.Thread.__init__(self)
 
def run(self):
print time.time()# appears on stdout
time.sleep(5)
print time.time()# appears on stdout
 
self.parent.Destroy()# ??? doesn't work if the mouse is
 outside of the application window
 
 class Alarm(wx.Frame):
def __init__(self, title, *args):
wx.Frame.__init__(self, None, -1, title, pos=(0, 0),
 size=(800, 600), *args)
 
self.sleepThread = MyThread(self)
self.sleepThread.start()
 
self.Bind(wx.EVT_CLOSE, self.on_close)
 
def on_close(self, event):
self.Destroy()
 
 ==
 
 To call it:
 
 class Main(wx.PySimpleApp):
def OnInit(self):
self.frame = alarm.Alarm(Alarm 0.1)
self.SetTopWindow(self.frame)
self.SetExitOnFrameDelete(True)
self.frame.Show()
return True
 
a = Main()
a.MainLoop()
 
 =
 -- 
 http://mail.python.org/mailman/listinfo/python-list

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


parsing compact index files (*.cdx)

2010-09-17 Thread Ethan Furman

Greetings!

Does anybody have any pointers, tips, web-pages, already written 
routines, etc, on parsing *.cdx files?  I have found the pages on MS's 
sight for Foxpro, but they neglect to describe the compaction algorithm 
used, and my Google-fu has failed to find any sites with that information.


Any and all help greatly appreciated!

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


Re: parsing compact index files (*.cdx)

2010-09-17 Thread MRAB

On 17/09/2010 20:16, Ethan Furman wrote:

Greetings!

Does anybody have any pointers, tips, web-pages, already written
routines, etc, on parsing *.cdx files? I have found the pages on MS's
sight for Foxpro, but they neglect to describe the compaction algorithm
used, and my Google-fu has failed to find any sites with that information.

Any and all help greatly appreciated!


Have you seen this:

http://www.archive.org/web/researcher/cdx_file_format.php
--
http://mail.python.org/mailman/listinfo/python-list


Re: parsing compact index files (*.cdx)

2010-09-17 Thread Ethan Furman

Ethan Furman wrote:

Greetings!

Does anybody have any pointers, tips, web-pages, already written 
routines, etc, on parsing *.cdx files?  I have found the pages on MS's 
sight for Foxpro, but they neglect to describe the compaction algorithm 
used, and my Google-fu has failed to find any sites with that information.


Any and all help greatly appreciated!

--
~Ethan~


Oops -- compact index files are *.idx; compound index files are *.cdx; 
I believe they use the same algorithm, though, at least for Foxpro.


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


Re: Too much code - slicing

2010-09-17 Thread Andreas Waldenburger
On Thu, 16 Sep 2010 16:20:33 -0400 AK andrei@gmail.com wrote:

 I also like this construct that works, I think, since 2.6:
 
 code = dir[int(num):] if side == 'l' else dir[:-1*int(num)]
 
I wonder when this construct will finally start to look good.

/W


-- 
INVALID? DE!

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


Re: parsing compact index files (*.cdx)

2010-09-17 Thread Ethan Furman

MRAB wrote:

On 17/09/2010 20:16, Ethan Furman wrote:

Greetings!

Does anybody have any pointers, tips, web-pages, already written
routines, etc, on parsing *.cdx files? I have found the pages on MS's
sight for Foxpro, but they neglect to describe the compaction algorithm
used, and my Google-fu has failed to find any sites with that 
information.


Any and all help greatly appreciated!


Have you seen this:

http://www.archive.org/web/researcher/cdx_file_format.php


I had not.  Unfortunately what I need are cdx files that are for dbf files.

Thanks anyway!

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


How to make a web services in python ???

2010-09-17 Thread Ariel
Hi everybody, I need some help to find documentation about how to implements
web services in python, could you help me please ???
Regards
Thanks in advance
Ariel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: self-closing window with wxPython

2010-09-17 Thread Jabba Laci
Hi,

 2) I saw this in the documentation for Destroy() -- Frames and dialogs are 
 not destroyed immediately when this function is called -- they are added to a 
 list of windows to be deleted on idle time, when all the window's events have 
 been processed. That might be consistent with what you're seeing. The window 
 you're trying to destroy has no events in its queue. WHen you move the mouse 
 over it, the window processes those mouse events and then wx realizes, Hey, 
 this window has processed all of its events, and it's on the list of windows 
 to be destroyed. I'd better get rid of it.

 If you're interested in experimenting, find a non-mouse way to force that 
 window to process an event and I'll bet that would have the same effect as 
 moving the mouse over it.

Thanks for the hint, I could solve the problem. After Destroy() I
added an extra event:

self.parent.Destroy()
self.parent.dc.SetFocus()

As you suggested, the extra event triggers the queue processing and
when it becomes empty the window gets destroyed.

Thanks,

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


Re: The trouble with dynamic attributes.

2010-09-17 Thread Cameron Simpson
On 17Sep2010 10:53, Ethan Furman et...@stoneleaf.us wrote:
| Lie Ryan wrote:
| [snip]
| And even dict-syntax is not perfect for accessing XML file, e.g.:
| 
| a
| bfoo/b
| bbar/b
| /a
| 
| should a['b'] be 'foo' or 'bar'?
| 
| Attribute style access would also fail in this instance -- how is
| this worked-around?

I'd be inclined to go for ('foo', 'bar'), though that makes all the
single occurence nodes into sequences too, a bit cumbersome:-(
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

alt.skunks  A newsgroup for enthusiasts of skunks and other mustelidae.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: self-closing window with wxPython

2010-09-17 Thread Ian Kelly
On Fri, Sep 17, 2010 at 3:00 PM, Jabba Laci jabba.l...@gmail.com wrote:

 Hi,

  2) I saw this in the documentation for Destroy() -- Frames and dialogs
 are not destroyed immediately when this function is called -- they are added
 to a list of windows to be deleted on idle time, when all the window's
 events have been processed. That might be consistent with what you're
 seeing. The window you're trying to destroy has no events in its queue. WHen
 you move the mouse over it, the window processes those mouse events and then
 wx realizes, Hey, this window has processed all of its events, and it's on
 the list of windows to be destroyed. I'd better get rid of it.
 
  If you're interested in experimenting, find a non-mouse way to force that
 window to process an event and I'll bet that would have the same effect as
 moving the mouse over it.

 Thanks for the hint, I could solve the problem. After Destroy() I
 added an extra event:

 self.parent.Destroy()
 self.parent.dc.SetFocus()

 As you suggested, the extra event triggers the queue processing and
 when it becomes empty the window gets destroyed.


You could also implement the alarm with a wxTimer instance that triggers a
wxTimerEvent, rather than creating a new thread for no good reason.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to make a web services in python ???

2010-09-17 Thread Hidura
What kind of web-service you have in mind

2010/9/17, Ariel isaacr...@gmail.com:
 Hi everybody, I need some help to find documentation about how to implements
 web services in python, could you help me please ???
 Regards
 Thanks in advance
 Ariel


-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SendKeys and Python 2.7

2010-09-17 Thread Jakson A. Aquino
 On Mon, Sep 13, 2010 at 4:02 PM, Michel Claveau - MVP
 enleverlesx_xx...@xmclavxeaux.com.invalid wrote:
 Sorry for time, but I am very busy...

 With Python + Pywin32, you can force the activation of a window (before
 send some keys...)
 See:
  win32gui.SetForegroundWindow(w_handle)

 or
  win32gui.SetActiveWindow(w_handle)



 For to find a windows (and his handle), see:
  win32gui.EnumWindows()
  win32gui.GetWindowTex()
 or
  win32gui.FindWindowEx()

I ended up using Dispatch(WScript.Shell) and AppActivate(R
Console) of the win32com.client module because they are higher level
functions. I guess that your code runs faster, but I don't have an old
machine to compare the performance of the two codes. I still may
switch to your code in the future, when I have easy access to a real
machine running Windows to make some tests. The released version of
the plugin is here:
http://www.vim.org/scripts/script.php?script_id=2628

Thanks for your help!

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


[OS X 10.5] hitting TAB inserts ./ in interactive mode ?

2010-09-17 Thread Nik Krumm
Hi all,

Thanks for your help. I installed python 2.7 on my Mac OS X 10.5.8
machine:


nik$ python
Python 2.7 (r27:82508, Jul  3 2010, 21:12:11)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type help, copyright, credits or license for more information.

and now, when I hit TAB or paste in a code snippet with tabs in them,
the interpreter tries to autocomplete a path, or inserts ./ if the
line is blank (just as readline would in the shell environment). It
does *not* try to autocomplete function (as readline would in python--
importing readline does turn on this functionality). And it does *not*
insert a tab, as I would like it to!

If i start my old python 2.5 which came with the OS, this is not a
problem.

I've tried setting a PYTHONIOENCODING, but that doesn't seem to be
doing the job.

Any ideas? Thanks in advance.
~Nik
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Too much code - slicing

2010-09-17 Thread Bas
On Sep 17, 10:01 pm, Andreas Waldenburger use...@geekmail.invalid
wrote:
 On Thu, 16 Sep 2010 16:20:33 -0400 AK andrei@gmail.com wrote:

  I also like this construct that works, I think, since 2.6:

  code = dir[int(num):] if side == 'l' else dir[:-1*int(num)]

 I wonder when this construct will finally start to look good.


Using IFs is just plain ugly. Why not go for the much more pythonic

code = (lambda s:dir[slice(*(s*int(num),None)[::s])])(cmp('o',side))

Much easier on the eyes and no code duplication ... ;)

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


Porting PEP 3148 to 2.x series

2010-09-17 Thread k3xji
Hi,

Is there any work on porting PEP 3148 back to 2.x series. That is a
wonderful PEP, any many long-running applications are really in need
of some stable library for handling stuff in async way just as
proposed in this PEP.

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


Re: Porting PEP 3148 to 2.x series

2010-09-17 Thread Ben Finney
k3xji sum...@gmail.com writes:

 Is there any work on porting PEP 3148 back to 2.x series. That is a
 wonderful PEP, any many long-running applications are really in need
 of some stable library for handling stuff in async way just as
 proposed in this PEP.

Better would be to port those applications that would benefit to Python
3.x.

-- 
 \ “To stay young requires unceasing cultivation of the ability to |
  `\   unlearn old falsehoods.” —Robert Anson Heinlein |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Too much code - slicing

2010-09-17 Thread Steven D'Aprano
On Fri, 17 Sep 2010 16:01:54 -0400, Andreas Waldenburger wrote:

 On Thu, 16 Sep 2010 16:20:33 -0400 AK andrei@gmail.com wrote:
 
 I also like this construct that works, I think, since 2.6:
 
 code = dir[int(num):] if side == 'l' else dir[:-1*int(num)]
 
 I wonder when this construct will finally start to look good.


It looks good to me. It follows a common English idiom:

What are you doing tonight?
I'll be going to the movies, if I finish work early, otherwise I'll stay 
home and watch a DVD.



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


Why IterableUserDict?

2010-09-17 Thread Steven D'Aprano
I was writing some tests for a mapping class I have made, and I decided 
to run those same tests over dict and UserDict. The built-in dict passed 
all the tests, but UserDict failed one:

class SimpleMappingTest(unittest.TestCase):
type2test = UserDict.UserDict
def test_iter(self):
k, v = [0, 1, 2, 3], 'abcd'
m = self.type2test(zip(k, v))
it = iter(m)
self.assert_(iter(it) is it)
self.assertEquals(sorted(it), k)  # This line fails.
# many more tests

To cut a long story short, the problem is that UserDict doesn't support 
the modern iteration protocol. Python falls back on the old-fashioned 
__getitem__ iteration protocol, but since it expects IndexError rather 
than KeyError, iteration fails for UserDict once it hits key=4.

If I look at the source code for the UserDict module, I discover that 
there's a second mapping class, IterableUserDict, specifically to make 
UserDict iterable. To do this requires a single one-line method:

class IterableUserDict(UserDict):
def __iter__(self):
return iter(self.data)

This class was apparently added to the module in 2.2 -- it doesn't exist 
in 2.1.

Now that boggles my brain. Why was support for iteration added as a 
subclass, instead of simply adding the __iter__ method to UserDict? 
UserDict is supposed to be a drop-in replacement for dict (although the 
use-cases for it are much fewer now that we can inherit from dict), so it 
doesn't make sense to me to have a non-iterable UserDict plus a subclass 
which is iterable.

Can anyone shed any light on this apparently bizarre design decision?



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


Re: [OS X 10.5] hitting TAB inserts ./ in interactive mode ?

2010-09-17 Thread Ned Deily
In article 
431250b2-391e-4a1f-ba72-08afb7159...@l25g2000prn.googlegroups.com,
 Nik Krumm nkr...@gmail.com wrote:
 Thanks for your help. I installed python 2.7 on my Mac OS X 10.5.8
 machine:
 
 
 nik$ python
 Python 2.7 (r27:82508, Jul  3 2010, 21:12:11)
 [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
 Type help, copyright, credits or license for more information.
 
 and now, when I hit TAB or paste in a code snippet with tabs in them,
 the interpreter tries to autocomplete a path, or inserts ./ if the
 line is blank (just as readline would in the shell environment). It
 does *not* try to autocomplete function (as readline would in python--
 importing readline does turn on this functionality). And it does *not*
 insert a tab, as I would like it to!

See the rlcompleter module in the standard library:
http://docs.python.org/library/rlcompleter.html

In my .bashrc file, I have a line:
[ -f ~/.pythonrc ]   export PYTHONSTARTUP=~/.pythonrc

and in the .pythonrc file, I include:

try:
import readline
except ImportError:
print(Module readline not available.)
else:
import rlcompleter
readline.parse_and_bind(tab: complete)

Note the print() form which works with either Python 2 or 3.

-- 
 Ned Deily,
 n...@acm.org

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


Re: WMI in Python

2010-09-17 Thread Lawrence D'Oliveiro
In message
210f30c4-22da-405f-ad4b-cc46841ca...@p22g2000pre.googlegroups.com, alex23 
wrote:

 Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:

 Because machine-generated
 code has no place in a source file to be maintained by a human.
 
 Endlessly repeating your bigotry doesn't make it any more true.

The point is that it is machine-generated from an input command, therefore 
it makes sense from a maintenance viewpoint to keep the input command, not 
the machine-generated output, in the source file, and simply generate the 
latter from the former as part of the build process.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket.error: [Errno 98] Address already in use

2010-09-17 Thread Lawrence D'Oliveiro
In message 
2f830099-4264-47bc-98ee-31950412a...@q21g2000prm.googlegroups.com, cerr 
wrote:

 I get a socket error [Errno 98] Address already in use when i try to
 open a socket that got closed before with close(). How come close()
 doesn't close the socket properly?

The usual case this happens is you have a client connection open at the 
time, that was not properly terminated. Then the TCP stack goes through a 
holdoff period (2 minutes, I believe it is), to make absolutely sure all 
packets destined for the old connection have completely disappeared off the 
entire Internet, before it will let you open a socket on the same port 
again.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue1653416] OS X print f, Hello produces no error: normal?

2010-09-17 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

This is not an issue for 3.x because the io library doesn't use stdio.

I'd say this is unlikely to get fixed in 2.7 as every call to stdio functions 
needs to be checked and updated.

--
versions:  -Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1653416
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9786] Native TLS support for pthreads

2010-09-17 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

Ok, here is a patch.  key creation returns -1 on error, and the caller can 
detect this and raise a fatal error.

--
Added file: http://bugs.python.org/file18906/pthread_tls.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9786
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1653416] OS X print f, Hello produces no error on read-only f: normal?

2010-09-17 Thread Eric O. LEBIGOT

Changes by Eric O. LEBIGOT eric.lebi...@normalesup.org:


--
title: OS X print  f, Hello produces no error: normal? - OS X print  f, 
Hello produces no error on read-only f: normal?

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1653416
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9880] Python 2.7 Won't Build: SystemError: unknown opcode

2010-09-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

For some reason your file os.pyc is corrupted:
I loaded it with a working python2.7:

import marshal, dis
pyc = open('bados.pyc', 'rb').read()
code = marshal.loads(pyc[8:])
dis.dis(code)

And it appears that all the jump instructions are wrong: the address is 
either 0, or something around 65536.

Which compiler do you use? I remember subtle bugs caused by some version of gcc.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9880
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5113] 2.5.4.3 / test_posix failing on HPUX systems

2010-09-17 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

Actually, looking at the man page, this seems to be normal:

---
In order to change the owner or group, you must own the file and have the CHOWN 
privilege (see setprivgrp(1M)). [...] Note that a given user's or group's 
ability to use this command can be restricted by setprivgrp (see 
setprivgrp(1M)).
---

So depending on the setting of setprivgrp, chown'ing a file to root may be 
allowed or not.
It might be a good idea to skip this test on HP-UX. Solaris apparently behaves 
in the same way.

--
nosy: +neologix

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5113
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9884] The 4th parameter of method always None or 0 on x64 Windows.

2010-09-17 Thread Owen

New submission from Owen j2.n...@gmail.com:

OS: Windows 2003STD x64 en

I have try to call python method from c++ dll by WINFUNCTYPE.
But the 4th parameter is always None or 0 if the type is int or void* (float is 
works fine).

Following is the part of source code:
==code==
import sys
from ctypes import *

windll.LoadLibrary(testPy2.dll)
#

def 
test3(param1,param2,param3,param4,param5,param6,param7,param8,param9,param10):
  print()
  print(param1)
  print(param2)
  print(param3)
  # the 4th param4 is always 0.
  print(param4)
  print(param5)
  print(param6)
  print(param7)
  print(param8)
  print(param9)
  print(param10)
  print()
  return 20
  
C_METHOD_TYPE4 = WINFUNCTYPE(c_int32, c_int32, c_int32, c_int32, c_int32, 
c_int32, c_int32, c_int32, c_int32, c_int32, c_int32)

windll.testPy2.fntestPy7(9,C_METHOD_TYPE4(test3))
==code==

To my knowledge, both visual c++ and gcc use registers for the first few 
parameters, and then after that use the stack.  Maybe this is the reason.

I have attached some simple codes for reproduce this issue.
issues
  - testPy2  - source code of the dll
  - test.py  - python file to reproduce the issue
  - testPy2.dll  - the dll to reproduce the issue

--
components: Windows
files: issues.zip
messages: 116649
nosy: J2.NETe
priority: normal
severity: normal
status: open
title: The 4th parameter of method always None or 0 on x64 Windows.
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file18907/issues.zip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9884
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9884] The 4th parameter of method always None or 0 on x64 Windows.

2010-09-17 Thread Owen

Changes by Owen j2.n...@gmail.com:


--
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9884
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9880] Python 2.7 Won't Build: SystemError: unknown opcode

2010-09-17 Thread Tom Browder

Tom Browder tom.brow...@gmail.com added the comment:

I'm using gcc-4.5.1.  I'll try an older version: gcc (Ubuntu 4.4.3-4ubuntu5) 
4.4.3.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9880
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9880] Python 2.7 Won't Build: SystemError: unknown opcode

2010-09-17 Thread Tom Browder

Tom Browder tom.brow...@gmail.com added the comment:

The build succeeded with the older version of gcc.  I either have a 
mis-compiled gcc-4.5.1 (but the same version on another host worked okay) or 
gcc has a very subtle bug.  I think this issue can be considered closed; 
however, it may be worth a note in a FAQ or build instructions.  Good catch 
Amaury!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9880
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9880] Python 2.7 Won't Build: SystemError: unknown opcode

2010-09-17 Thread Tom Browder

Tom Browder tom.brow...@gmail.com added the comment:

Correction on the bad gcc compiler: the actual version was a non-released 
version off the gcc-4.6 branch:  gcc version 4.6.0 20100908 (experimental) 
(GCC).  I'm filing a bug with gcc.  Sorry for the wasted time.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9880
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9872] `a.b.my_function is not b.my_function` when `a` and `b` are both on `sys.path`

2010-09-17 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

Benjamin,

This behavior is involved in a problem I have with Django. When using Django, 
you have apps that live inside a project:

my_project\
  __init__.py
  my_app\
__init__.py
views.py

So if you have a view function in `views.py`, it will have two separate 
identities, and that causes problems.

Do you have an idea what I can do about it?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9872
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9880] Python 2.7 Won't Build: SystemError: unknown opcode

2010-09-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

You're welcome.
Please join a link to the gcc bug when you have one.

--
resolution:  - invalid
status: open - pending

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9880
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9872] `a.b.my_function is not b.my_function` when `a` and `b` are both on `sys.path`

2010-09-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

I suggest to report this to the Django team.

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9872
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9885] Function Round does not work properly in some conditions

2010-09-17 Thread paontis

New submission from paontis paor...@gmail.com:

For example round(10., 1) returns 10.301 and round(1., 
2)returns 1.3301

I exect they return 10.3 and 1.33 rispectively

NOTE: other combinations work fine eg. round(10., 2) or round(1., 3)

See IDLE commands in the attached file round.txt

Used Python 2.6.6 for Windows

--
files: round.txt
messages: 116656
nosy: paontis
priority: normal
severity: normal
status: open
title: Function Round does not work properly in some conditions
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file18908/round.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9885
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9880] Python 2.7 Won't Build: SystemError: unknown opcode

2010-09-17 Thread Tom Browder

Tom Browder tom.brow...@gmail.com added the comment:

Here is a link to the thread I started on the gcc-help mailing list concerning 
the issue: 

  http://gcc.gnu.org/ml/gcc-help/2010-09/msg00170.html

If I don't get a successful build with the current gcc trunk, I imagine this 
thread will transfer to the gcc (dev) list--I'll try to keep the links up.

--
status: pending - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9880
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9886] Make operator.itemgetter/attrgetter/methodcaller easier to discover

2010-09-17 Thread Nick Coghlan

New submission from Nick Coghlan ncogh...@gmail.com:

The observation has been made that there are some idioms related to key 
functions passed to various methods and functions that aren't particularly easy 
to discover.

One suggestion is to create a key function glossary entry that provides 
examples of standard library operations that exist primarily for use as key 
functions (i.e. the three functions mentioned in the issue title), as well as 
mentioning some of the APIs that accept key functions (e.g. sorted, list.sort, 
min, max). The documentation of these various could then cross link to the key 
function glossary entry to make this idioms more discoverable without needing 
to repeat ourselves in the documentation of every method that accepts a key 
function.

As per discussion on python-ideas, including the glossary entry suggestion from 
Terry Reedy:
http://mail.python.org/pipermail/python-ideas/2010-September/008093.html

--
assignee: d...@python
components: Documentation
messages: 116658
nosy: d...@python, ncoghlan
priority: normal
severity: normal
status: open
title: Make operator.itemgetter/attrgetter/methodcaller easier to discover
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9886
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9886] Make operator.itemgetter/attrgetter/methodcaller easier to discover

2010-09-17 Thread Daniel Stutzbach

Changes by Daniel Stutzbach dan...@stutzbachenterprises.com:


--
nosy: +stutzbach

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9886
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1690840] xmlrpclib methods submit call on __str__, __repr__

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

This has been fixed in py3k but not 2.7.  Is it worth backporting the change?

--
nosy: +BreamoreBoy
resolution:  - fixed
stage:  - committed/rejected
status: open - pending
type:  - behavior
versions: +Python 2.7, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1690840
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

2010-09-17 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
versions: +Python 2.7, Python 3.2 -Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1692335
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1693546] email.Message set_param rfc2231 encoding incorrect

2010-09-17 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6, Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1693546
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9887] distutil's build_scripts doesn't read utf-8 in all locales

2010-09-17 Thread Hagen Fürstenau

New submission from Hagen Fürstenau hfuerste...@gmx.net:

LANG=C python3 setup.py build_scripts chokes on UTF-8 encoded scripts. The 
problem is that copy_scripts uses open without specifying an encoding. This 
issue may be related to #9561.

--
assignee: tarek
components: Distutils
messages: 116660
nosy: eric.araujo, hagen, tarek
priority: normal
severity: normal
status: open
title: distutil's build_scripts doesn't read utf-8 in all locales
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9887
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1699594] shlex fails to parse strings correctly

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

@Georg: seems like your r55549 and r0 fixed this, am I correct?

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1699594
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1703592] have a way to ignore nonexisting locales in locale.setlocale

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

Is this still an issue on Debian and Ubuntu?

--
nosy: +BreamoreBoy, lemburg

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1703592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9873] Allow bytes in some APIs that use string literals internally

2010-09-17 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

From the python-dev thread 
(http://mail.python.org/pipermail/python-dev/2010-September/103780.html):
==
So the domain of any polymorphic text manipulation functions we define would be:
 - Unicode strings
 - byte sequences where the encoding is either:
   - a single byte ASCII superset (e.g. iso-8859-*, cp1252, koi8*, mac*)
   - an ASCII compatible multibyte encoding (e.g. UTF-8, EUC-JP)

Passing in byte sequences that are encoded using an ASCII incompatible
multibyte encoding (e.g. CP932, UTF-7, UTF-16, UTF-32, shift-JIS,
big5, iso-2022-*, EUC-CN/KR/TW) or a single byte encoding that is not
an ASCII superset (e.g. EBCDIC) will have undefined results.
==

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9873
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1704474] optparse tests fail under Jython

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

How do we find out which versions of optparse and test_optparse jython is 
currently using?

--
nosy: +BreamoreBoy
versions:  -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1704474
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1705393] Select() failure (race condition)

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I've changed things in reply to msg85311, feel free to alter things again if 
you disagree.

--
assignee:  - d...@python
components: +Documentation -Extension Modules, Library (Lib)
nosy: +BreamoreBoy, d...@python
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6, Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1705393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1705520] pyunit should allow __unittest in locals to trim stackframes

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

is this still relevant?

--
nosy: +BreamoreBoy
versions:  -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1705520
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1705520] pyunit should allow __unittest in locals to trim stackframes

2010-09-17 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

It is relevant and would be *possible* to implement. I'm not 100% convinced it 
is a good *enough* idea to make it worth adding though. I'd like to leave the 
issue open for the moment in case other people want to comment.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1705520
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1703592] have a way to ignore nonexisting locales in locale.setlocale

2010-09-17 Thread Colin Watson

Colin Watson cjwat...@users.sourceforge.net added the comment:

Yes, the same symptoms are still present.

I'd argue that it generally isn't an error in practice for applications, and 
thus the net effect of this exception is negative; it's extraordinarily rare 
for a crash to be preferable to running without localisation.  Adding a new 
function would help because I think it would be easier to persuade people to 
call a new function that just does what they want (turn on localisation if 
possible) than to catch an exception (at which point they have to think hm, 
could that exception be for some other reason than 
you-just-don't-have-that-locale, etc.).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1703592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9885] Function Round does not work properly in some conditions

2010-09-17 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Please read

http://docs.python.org/tutorial/floatingpoint.html

Although your case isn't directly covered there, the root cause is the same.  
Floating point can't exactly represent 10.3.

Note that in Python2.7 and 3.x, the repr will be shortened to 10.3, so if you'd 
tried this there you would never have noticed the underlying issue.

If you need exact decimal arithmetic, use the Decimal module.

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9885
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9885] Function Round does not work properly in some conditions

2010-09-17 Thread paontis

paontis paon...@gmail.com added the comment:

ok thx very much for the explaination

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9885
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6627] threading.local() does not work with C-created threads

2010-09-17 Thread Swapnil Talekar

Swapnil Talekar swapnil...@gmail.com added the comment:

As far as I know, the thread creation done in the file is not correct. While 
creating threads in C extension, there are certain rules to follow. Firstly, 
Python should be made thread-aware if it is not already i.e. call 
PyEval_InitThreads in the C callback function. After its creation, the thread 
should bootstrap to be able to execute Python code. It should create a new 
PyThreadState for itself by calling PyThreadState_New. For this, the thread 
should be passed the InterpreterState* through the entry function. Before 
executing any Python code, the thread should make sure that the current 
ThreadState * is corresponding to it by calling PyEval_RestoreThread.
Refer 
http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock

--
nosy: +swapnil

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9877] Expose sysconfig._get_makefile_filename() in public API

2010-09-17 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9877
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6627] threading.local() does not work with C-created threads

2010-09-17 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Swapnil's analysis looks correct to me - there are certain rules you have to 
follow before calling back into the Python interpreter core. If you don't 
follow them, the behaviour you will get is completely undefined.

If the problem still occurs even when the C thread is correctly initialised for 
calling into the Python C API then this issue can be reopened.

--
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6627] threading.local() does not work with C-created threads

2010-09-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

One more thing:
in the sample code, the thread initializes no PyThreadState. So the ctypes 
callback creates a temporary PyThreadState just for the duration of the call.

This explains the difference between threading.local and _threading_local:

- threading.local() uses the PyThreadState to store its data: You get a new 
value on each call.
- _threading_local.local() uses a global dictionary indexed by the thread id: 
the same value is retained across call.

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9882] abspath from directory

2010-09-17 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
versions:  -Python 2.7, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9882
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1706323] Updated ASTVisitor Classes

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

Is this still relevant given the addition of the ast module in r64064?

--
nosy: +BreamoreBoy
versions: +Python 3.2 -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1706323
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1708652] Exact matching

2010-09-17 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
nosy: +mrabarnett

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1708652
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1709112] test_1686475 of test_os pagefile.sys

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

@Brian/Tim the attached patches have not been applied, what do you make of this 
one?

--
components: +Extension Modules -Windows
nosy: +BreamoreBoy, brian.curtin, tim.golden

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1709112
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1708652] Exact matching

2010-09-17 Thread Matthew Barnett

Matthew Barnett pyt...@mrabarnett.plus.com added the comment:

Does this request still stand? If so then I'll add it to the new regex module.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1708652
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1710703] zipfile.ZipFile behavior inconsistent.

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I don't think the latest patch has been committed, could someone wave their 
magic wand please :)

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1710703
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2236] Distutils' mkpath implementation ignoring the mode parameter

2010-09-17 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

Fixed for py3k in r84861, release31-maint in r84863 and release27-maint in 
r84862.

Thanks for patch, Carlos Henrique Romano.

--
nosy: +orsenthil
resolution:  - fixed
stage: unit test needed - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2236
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1724822] provide a shlex.split alternative for Windows shell syntax

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

Already fixed by r55549 and r0.

--
nosy: +BreamoreBoy
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1724822
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1727418] xmlrpclib waits indefinately

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

Can this be closed due to work on #6267?

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1727418
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1724822] provide a shlex.split alternative for Windows shell syntax

2010-09-17 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

No, this feature request has not been satisfied.  Georg fixed some subsidiary 
issues, but they did not in fact address the feature request for an shlex.split 
equivalent for Windows.

Since no one has expressed interest in working on this, even though model code 
has been offered, I'm changing the resolution to languishing rather than 
reopening it.  Perhaps someone with an itch to scratch will decide to pick it 
up eventually.

--
assignee: georg.brandl - 
nosy: +r.david.murray
resolution: fixed - 
status: closed - languishing

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1724822
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1729930] 2.5.1 latest svn fails test_curses and test_timeout

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I can't believe that this is still relevant.

--
nosy: +BreamoreBoy
resolution:  - out of date
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1729930
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1730136] tkFont.__eq__ gives type error

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I think this one line patch still needs applying.

--
nosy: +BreamoreBoy
type:  - behavior
versions:  -Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1730136
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1729930] 2.5.1 latest svn fails test_curses and test_timeout

2010-09-17 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

The bug probably does still exist (see issue 7038 for a recent similar report). 
 However, without a repeatable test case we can't fix it, so leaving this 
closed is fine.  If the OP can still reproduce it we can try working on it 
again.

--
nosy: +r.david.murray
resolution: out of date - works for me

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1729930
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1730372] Mesa with NPTL makes Python extensions crash with std::cerr

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

Could a Linux guru try to reproduce this with the latest trunk, thanks.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1730372
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1732367] Document the constants in the socket module

2010-09-17 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

msg67121 states proposed changes were lost :(

--
nosy: +BreamoreBoy
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1732367
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >