comp.lang.python - 25 new messages in 18 topics - digest
comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en
comp.lang.python@googlegroups.com
Today's topics:
* Threading, Queue for a function so it only runs once at a time. - 1 messages,
1 author
http://groups.google.com/group/comp.lang.python/t/7896ac48f32d8599?hl=en
* StringChain -- a data structure for managing large sequences of chunks of
bytes - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/0289b7f3bff4d999?hl=en
* file seek is slow - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/f9c31a229cdda107?hl=en
* bypass UAC control through python script (to be run from batchfile) - 1
messages, 1 author
http://groups.google.com/group/comp.lang.python/t/0be68444d9e945d2?hl=en
* NoSQL Movement? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/942e22a0145599b2?hl=en
* Need advice on starting a Python group - 5 messages, 5 authors
http://groups.google.com/group/comp.lang.python/t/0a24bf882c72c555?hl=en
* Python, Reportlabs, Pil and Windows 7 (64bit) - 3 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/8f0199cb036d7949?hl=en
* Reverse engineering CRC? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/b22db1e3e63db596?hl=en
* show image in python - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/028dadaea24719e0?hl=en
* Unicode characters in btye-strings - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/77271907fb195aca?hl=en
* Parsing Email Headers - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/26ed04329c1dc7a7?hl=en
* Anything like "Effective Java" for Python? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/47674ff2d2c78fa6?hl=en
* execute bash builtins in python - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/566f672d7f34e3ab?hl=en
* Python dos2unix one liner - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/c4b63debe91d51c7?hl=en
* result of os.times() is different with 'time' command Options - 1 messages,
1 author
http://groups.google.com/group/comp.lang.python/t/ab45c1ed3e45401c?hl=en
* python module/utility equivalent to 'time' (linux) and/or 'ntimer'(Windows) -
1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/669dba3b5f181123?hl=en
* to create variable from dict - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/9a2ccf6e5c80789b?hl=en
* inspect.stack() and frame - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/fc8bf697fa9a01a4?hl=en
==============================================================================
TOPIC: Threading, Queue for a function so it only runs once at a time.
http://groups.google.com/group/comp.lang.python/t/7896ac48f32d8599?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Mar 11 2010 11:11 pm
From: "John P."
Hi,
Im programming a simple webcrawler with threading for the fun of it, which
is inserting the data fetch into a mysql database, but after continuously
cause my mysql server to produce error during database queries (i assume
its cause because of the many execution at the same time.) the scipt
produces errors.
I figured out i need some kind of queue for the function i use to insert
into the database, to make sure its only called once at a time.
I have looked at the Queue module but its for more complicated than my
current python skills can cope with. :)
Would somebody please help me out here?
Thanks.
--
John P.
==============================================================================
TOPIC: StringChain -- a data structure for managing large sequences of chunks
of bytes
http://groups.google.com/group/comp.lang.python/t/0289b7f3bff4d999?hl=en
==============================================================================
== 1 of 2 ==
Date: Fri, Mar 12 2010 12:52 am
From: Steven D'Aprano
On Fri, 12 Mar 2010 00:11:37 -0700, Zooko O'Whielacronx wrote:
> Folks:
>
> Every couple of years I run into a problem where some Python code that
> worked well at small scales starts burning up my CPU at larger scales,
> and the underlying issue turns out to be the idiom of accumulating data
> by string concatenation.
I don't mean to discourage you, but the simple way to avoid that is not
to accumulate data by string concatenation.
The usual Python idiom is to append substrings to a list, then once, at
the very end, combine into a single string:
accumulator = []
for item in sequence:
accumulator.append(process(item))
string = ''.join(accumulator)
> It just happened again
> (http://foolscap.lothar.com/trac/ticket/149 ), and as usual it is hard
> to make the data accumulator efficient without introducing a bunch of
> bugs into the surrounding code.
I'm sorry, I don't agree about that at all. I've never come across a
situation where I wanted to use string concatenation and couldn't easily
modify it to use the list idiom above.
[...]
> Here are some benchmarks generated by running python -OOu -c 'from
> stringchain.bench import bench; bench.quick_bench()' as instructed by
> the README.txt file.
To be taken seriously, I think you need to compare stringchain to the
list idiom. If your benchmarks favourably compare to that, then it might
be worthwhile.
--
Steven
== 2 of 2 ==
Date: Fri, Mar 12 2010 5:40 am
From: MRAB
Steven D'Aprano wrote:
> On Fri, 12 Mar 2010 00:11:37 -0700, Zooko O'Whielacronx wrote:
>
>> Folks:
>>
>> Every couple of years I run into a problem where some Python code that
>> worked well at small scales starts burning up my CPU at larger scales,
>> and the underlying issue turns out to be the idiom of accumulating data
>> by string concatenation.
>
> I don't mean to discourage you, but the simple way to avoid that is not
> to accumulate data by string concatenation.
>
> The usual Python idiom is to append substrings to a list, then once, at
> the very end, combine into a single string:
>
>
> accumulator = []
> for item in sequence:
> accumulator.append(process(item))
> string = ''.join(accumulator)
>
>
>> It just happened again
>> (http://foolscap.lothar.com/trac/ticket/149 ), and as usual it is hard
>> to make the data accumulator efficient without introducing a bunch of
>> bugs into the surrounding code.
>
> I'm sorry, I don't agree about that at all. I've never come across a
> situation where I wanted to use string concatenation and couldn't easily
> modify it to use the list idiom above.
>
> [...]
>> Here are some benchmarks generated by running python -OOu -c 'from
>> stringchain.bench import bench; bench.quick_bench()' as instructed by
>> the README.txt file.
>
> To be taken seriously, I think you need to compare stringchain to the
> list idiom. If your benchmarks favourably compare to that, then it might
> be worthwhile.
>
IIRC, someone did some work on making concatenation faster by delaying
it until a certain threshold had been reached (in the string class
implementation).
==============================================================================
TOPIC: file seek is slow
http://groups.google.com/group/comp.lang.python/t/f9c31a229cdda107?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 12:56 am
From: Stefan Behnel
Metalone, 11.03.2010 23:57:
> I just tried the seek test with Cython.
> Cython fseek() : 1.059 seconds. 30% slower than 'C'
> Python f.seek : 1.458 secondds. 80% slower than 'C'.
>
> It is amazing to me that Cython generates a 'C' file that is 1478
> lines.
Well, it generated an optimised Python interface for your module and made
it compilable in CPython 2.3 through 3.2. It doesn't look like your C
module features that. ;)
> #Cython code
>
> import time
>
> cdef int SEEK_SET = 0
>
> cdef extern from "stdio.h":
> void* fopen(char* filename, char* mode)
> int fseek(void*, long, int)
Cython ships with a stdio.pxd that you can cimport. It looks like it
doesn't currently define fseek(), but it defines at least fopen() and FILE.
Patches are always welcome.
> def main():
> cdef void* f1 = fopen('video.txt', 'rb')
> cdef int i=1000000
> t0 = time.clock()
> while i> 0:
> fseek(f1, 0, SEEK_SET)
> i -= 1
> delta = time.clock() - t0
Note that the call to time.clock() takes some time, too, so it's not
surprising that this is slower than hand-written C code. Did you test how
it scales?
Also, did you look at the generated C code or the annotated Cython code
(cython -a)? Did you make sure both were compiled with the same CFLAGS?
Also, any reason you're not using a for-in-xrange loop? It shouldn't make a
difference in speed, it's just more common. You even used a for loop in
your C code.
Finally, I'm not sure why you think that these 30% matter at all. In your
original post, you even state that seek-time isn't the "deal breaker", so
maybe you should concentrate on the real issues?
Stefan
==============================================================================
TOPIC: bypass UAC control through python script (to be run from batchfile)
http://groups.google.com/group/comp.lang.python/t/0be68444d9e945d2?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 1:00 am
From: "rizwanahmed24@gmail.com"
Hi Michel. what is this 'resident soff' script, i cannot find it on
google. Secondly if i was to install something in admin mode, then i
would have installed the application i want to install. The actual
problem is that i dont want to manually run something with admin
rights and install.
still havent got the solution
==============================================================================
TOPIC: NoSQL Movement?
http://groups.google.com/group/comp.lang.python/t/942e22a0145599b2?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 1:05 am
From: Jonathan Gardner
On Wed, Mar 3, 2010 at 2:41 PM, Avid Fan <me@privacy.net> wrote:
> Jonathan Gardner wrote:
>>
>> I see it as a sign of maturity with sufficiently scaled software that
>> they no longer use an SQL database to manage their data. At some point
>> in the project's lifetime, the data is understood well enough that the
>> general nature of the SQL database is unnecessary.
>>
>
> I am really struggling to understand this concept.
>
> Is it the normalised table structure that is in question or the query
> language?
>
> Could you give some sort of example of where SQL would not be the way to go.
> The only things I can think of a simple flat file databases.
Sorry for the late reply.
Let's say you have an application that does some inserts and updates
and such. Eventually, you are going to run into a limitation with the
number of inserts and updates you can do at once. The typical solution
to this is to shard your database. However, there are other solutions,
such as storing the files in a different kind of database, one which
is less general but more efficient for your particular data.
Let me give you an example. I worked on a system that would load
recipients for email campaigns into a database table. The SQL database
was nice during the initial design and prototype stage because we
could quickly adjust the tables to add or remove columns and try out
different designs.. However, once our system got popular, the
limitation was how fast we could load recipients into the database.
Rather than make our DB bigger or shard the data, we discovered that
storing the recipients outside of the database in flat files was the
precise solution we needed. Each file represented a different email
campaign. The nature of the data was that we didn't need random
access, just serial access. Storing the data this way also meant
sharding the data was almost trivial. Now, we can load a massive
number of recipients in parallel.
You are going to discover certain patterns in how your data is used
and those patterns may not be best served by a generic relational
database. The relational database will definitely help you discover
and even experiment with these patterns, but eventually, you will find
its limits.
--
Jonathan Gardner
jgardner@jonathangardner.net
==============================================================================
TOPIC: Need advice on starting a Python group
http://groups.google.com/group/comp.lang.python/t/0a24bf882c72c555?hl=en
==============================================================================
== 1 of 5 ==
Date: Fri, Mar 12 2010 1:14 am
From: Jonathan Gardner
On Thu, Mar 11, 2010 at 6:57 AM, gb345 <gb345@invalid.com> wrote:
>
> And even when we've had volunteers, hardly anyone shows up!
>
> Any suggestions would be appreciated.
>
Two things: One, only you and your friend really care. Let that sink
in. No one is going to carry the group but you two, at least
initially.
Two, there's a lot of people at movie theaters and the county fair.
Why? Because it is interesting and fun. Scientists work the same way.
Yes, a lot of people are interested in Python. Why don't you do a bit
of snooping around and see what people want to know about?
Let me give some examples:
* Interactive numeric programming with Python
* Rapid website development with Pylons (Trust me, everyone wants to
make a website.) Show how you are showing off data from one of your
experiments of projects and how easy it is to organize and manage
data.
* How you used Python on your latest and greatest project
Don't expect the audience to participate, except to show up and ask questions.
If you want to build a Python support group, then form an informal
group with your friends. Start a public mailing list and offer Python
advice and support for free. Integrate whatever code your org has with
Python, and manage and maintain that code so others can use it.
Finally, advertise. The more people see "Python", the more they will
be interested. Coca-cola and Pepsi are really good at this!
--
Jonathan Gardner
jgardner@jonathangardner.net
== 2 of 5 ==
Date: Fri, Mar 12 2010 3:39 am
From: News123
Jonathan Gardner wrote:
> On Thu, Mar 11, 2010 at 6:57 AM, gb345 <gb345@invalid.com> wrote:
>> And even when we've had volunteers, hardly anyone shows up!
>>
>> Any suggestions would be appreciated.
>>
>
> Two things: One, only you and your friend really care. Let that sink
> in. No one is going to carry the group but you two, at least
> initially.
>
> Two, there's a lot of people at movie theaters and the county fair.
> Why? Because it is interesting and fun. Scientists work the same way.
> Yes, a lot of people are interested in Python. Why don't you do a bit
> of snooping around and see what people want to know about?
>
> Let me give some examples:
>
> * Interactive numeric programming with Python
> * Rapid website development with Pylons (Trust me, everyone wants to
> make a website.) Show how you are showing off data from one of your
> experiments of projects and how easy it is to organize and manage
> data.
> * How you used Python on your latest and greatest project
>
> Don't expect the audience to participate, except to show up and ask questions.
>
> If you want to build a Python support group, then form an informal
> group with your friends. Start a public mailing list and offer Python
> advice and support for free. Integrate whatever code your org has with
> Python, and manage and maintain that code so others can use it.
>
> Finally, advertise. The more people see "Python", the more they will
> be interested. Coca-cola and Pepsi are really good at this!
>
attendance will be very low and be sure nobody cares to check whether
anything happened on this group.
My suggestion is:
I'd suggest to setup a group, to which one can subscribe with mail
notification and for all the old ones perhaps even via nntp ;-) and of
course via a web front end (though I personally hate web groups)
Afterwards you can 'friendly-fore-subscribe' some collegues. ;-)
Just talk about your new cool group during lunch, etc.
Be sure, that most will be to lazy to unsuscribe.
Start discussing interesting topics on this group and then . . .
maybe others start joining. maybo nobody cares and you have just to
accept it.
bye
N
== 3 of 5 ==
Date: Fri, Mar 12 2010 4:51 am
From: Jean-Michel Pichavant
News123 wrote:
> Jonathan Gardner wrote:
>
>> On Thu, Mar 11, 2010 at 6:57 AM, gb345 <gb345@invalid.com> wrote:
>>
>>> And even when we've had volunteers, hardly anyone shows up!
>>>
>>> Any suggestions would be appreciated.
>>>
>>>
>> Two things: One, only you and your friend really care. Let that sink
>> in. No one is going to carry the group but you two, at least
>> initially.
>>
>> Two, there's a lot of people at movie theaters and the county fair.
>> Why? Because it is interesting and fun. Scientists work the same way.
>> Yes, a lot of people are interested in Python. Why don't you do a bit
>> of snooping around and see what people want to know about?
>>
>> Let me give some examples:
>>
>> * Interactive numeric programming with Python
>> * Rapid website development with Pylons (Trust me, everyone wants to
>> make a website.) Show how you are showing off data from one of your
>> experiments of projects and how easy it is to organize and manage
>> data.
>> * How you used Python on your latest and greatest project
>>
>> Don't expect the audience to participate, except to show up and ask questions.
>>
>> If you want to build a Python support group, then form an informal
>> group with your friends. Start a public mailing list and offer Python
>> advice and support for free. Integrate whatever code your org has with
>> Python, and manage and maintain that code so others can use it.
>>
>> Finally, advertise. The more people see "Python", the more they will
>> be interested. Coca-cola and Pepsi are really good at this!
>>
>>
>
>
> attendance will be very low and be sure nobody cares to check whether
> anything happened on this group.
>
> My suggestion is:
>
>
> I'd suggest to setup a group, to which one can subscribe with mail
> notification and for all the old ones perhaps even via nntp ;-) and of
> course via a web front end (though I personally hate web groups)
>
> Afterwards you can 'friendly-fore-subscribe' some collegues. ;-)
> Just talk about your new cool group during lunch, etc.
>
> Be sure, that most will be to lazy to unsuscribe.
>
> Start discussing interesting topics on this group and then . . .
> maybe others start joining. maybo nobody cares and you have just to
> accept it.
>
> bye
>
>
> N
>
Python is not interesting enough by itself to grab students attention.
It's just a tool to solve some technical problems.
So, either python has a direct benefit on the study itself (meaning it
can help getting better results), or you'll have to make it intereseting
as a hobbit. But python is not music, video, dance nor it is related to
sport, sex or whatever things that usually interest people. So I really
don't know how to make it interesting, I'm not sure it's even possible
nor desirable.
Good luck anyway.
JM
== 4 of 5 ==
Date: Fri, Mar 12 2010 5:04 am
From: Steve Holden
Jean-Michel Pichavant wrote:
> News123 wrote:
>> Jonathan Gardner wrote:
>>
>>> On Thu, Mar 11, 2010 at 6:57 AM, gb345 <gb345@invalid.com> wrote:
>>>
>>>> And even when we've had volunteers, hardly anyone shows up!
>>>>
>>>> Any suggestions would be appreciated.
>>>>
>>>>
>>> Two things: One, only you and your friend really care. Let that sink
>>> in. No one is going to carry the group but you two, at least
>>> initially.
>>>
>>> Two, there's a lot of people at movie theaters and the county fair.
>>> Why? Because it is interesting and fun. Scientists work the same way.
>>> Yes, a lot of people are interested in Python. Why don't you do a bit
>>> of snooping around and see what people want to know about?
>>>
>>> Let me give some examples:
>>>
>>> * Interactive numeric programming with Python
>>> * Rapid website development with Pylons (Trust me, everyone wants to
>>> make a website.) Show how you are showing off data from one of your
>>> experiments of projects and how easy it is to organize and manage
>>> data.
>>> * How you used Python on your latest and greatest project
>>>
>>> Don't expect the audience to participate, except to show up and ask
>>> questions.
>>>
>>> If you want to build a Python support group, then form an informal
>>> group with your friends. Start a public mailing list and offer Python
>>> advice and support for free. Integrate whatever code your org has with
>>> Python, and manage and maintain that code so others can use it.
>>>
>>> Finally, advertise. The more people see "Python", the more they will
>>> be interested. Coca-cola and Pepsi are really good at this!
>>>
>>>
>>
>>
>> attendance will be very low and be sure nobody cares to check whether
>> anything happened on this group.
>>
>> My suggestion is:
>>
>>
>> I'd suggest to setup a group, to which one can subscribe with mail
>> notification and for all the old ones perhaps even via nntp ;-) and of
>> course via a web front end (though I personally hate web groups)
>>
>> Afterwards you can 'friendly-fore-subscribe' some collegues. ;-)
>> Just talk about your new cool group during lunch, etc.
>>
>> Be sure, that most will be to lazy to unsuscribe.
>>
>> Start discussing interesting topics on this group and then . . .
>> maybe others start joining. maybo nobody cares and you have just to
>> accept it.
>>
>> bye
>>
>>
>> N
>>
> Python is not interesting enough by itself to grab students attention.
> It's just a tool to solve some technical problems.
>
> So, either python has a direct benefit on the study itself (meaning it
> can help getting better results), or you'll have to make it intereseting
> as a hobbit. But python is not music, video, dance nor it is related to
> sport, sex or whatever things that usually interest people. So I really
> don't know how to make it interesting, I'm not sure it's even possible
> nor desirable.
>
> Good luck anyway.
>
> JM
>
>
All the advice you have had is good. You need to turn around your
enthusiasm and look at it from the potential visitor's point of view -
what's in it for them?
You don't say where you are (and your invalid domain doesn't really help
identify that), but if you have any of the superstars from the
scientific Python world around you, invite one of them as a guest speaker.
Take a look on the web - e.g. in pycon.blip.tv, where all the PyCon
talks for the last two years are available. Maybe you could start each
meeting by showing one of those videos? Also take a look to see what
SciPy conferences have made available (though I don't think they do
videos yet).
The PSF has invested hugely in making that information available, and
the more they get used the happier we will be. But mostly it's a matter
of focusing on what your community needs from the group, and providing that.
Good luck!
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
== 5 of 5 ==
Date: Fri, Mar 12 2010 5:38 am
From: "bartc"
"gb345" <gb345@invalid.com> wrote in message
news:hnb0d1$2el$1@reader1.panix.com...
> A friend of mine and I have been trying to start a
> scientific-programming-oriented Python group in our school (of
> medecine and bio research), with not much success.
>
> The main problem is attendance. Even though a *ton* of people have
> told us that it's a great idea, that they're *very* interested,
> and have asked to be added to our mailing list, the attendance to
> our first few meeting has never been more than 5, including my
> friend and I. Last time just he and I showed up.
...
> Still, we have a hard time finding volunteers.
>
> And even when we've had volunteers, hardly anyone shows up!
>
> Any suggestions would be appreciated.
Try and get a girl or two interested in coming to the meetings...
--
Bartc
==============================================================================
TOPIC: Python, Reportlabs, Pil and Windows 7 (64bit)
http://groups.google.com/group/comp.lang.python/t/8f0199cb036d7949?hl=en
==============================================================================
== 1 of 3 ==
Date: Fri, Mar 12 2010 2:16 am
From: Robin Becker
Following the information from MvL I will try and get the 2.6 pyds built for
amd64, I see that there's a cross platform compile technique for distutils, but
am not sure if it applies to bdist_winexe etc etc. I'll have a go at this next week.
--
Robin Becker
== 2 of 3 ==
Date: Fri, Mar 12 2010 3:40 am
From: Robin Becker
On 11/03/2010 18:00, Martin v. Loewis wrote:
>
>>> I have a Windows 7 (64bit AMD) machine
......
>
>> Perhaps some expert on the python list knows which versions of VS
>> support 64bit; I do have VS 2005/2008 etc, but I'll probably need to set
>> up a 64bit machine to see if they will install on a 64bit architecture.
>
> For Python 2.6 and later, use VS 2008. This comes with an AMD64
> compiler. You technically don't need a 64-bit Windows, as it supports
> cross-compilation (but you would need a 64-bit Windows to test it).
>
> I personally build Python on a 32-bit machine, and move the MSI to a
> 64-bit machine for testing.
>
OK I've got the VC2008 64bit tools installed on my 32bit build platform, but I'm
getting build errors because of missing libraries. I assume that's because I
don't have the python amd64 runtime libraries/dlls etc etc since the errors are
looking like this
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_Py_FindMethod
referenced in function Box_getattr
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyObject_Init
referenced in function Box
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyObject_Malloc
referenced in function Box
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyList_Type
referenced in function BoxList_init
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_Py_FatalError
referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyType_Ready
referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyType_Type
referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol
__imp_PyModule_AddObject referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol
__imp_PyErr_NewException referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol
__imp_Py_InitModule4_64 referenced in function init_rl_accel
build\lib.win-amd64-2.6\_rl_accel.pyd : fatal error LNK1120: 69 unresolved externals
I assume I can get those from a working Python amd64 install and stuff on one of
the compiler paths somehow.
--
Robin Becker
== 3 of 3 ==
Date: Fri, Mar 12 2010 3:40 am
From: Robin Becker
On 11/03/2010 18:00, Martin v. Loewis wrote:
>
>>> I have a Windows 7 (64bit AMD) machine
......
>
>> Perhaps some expert on the python list knows which versions of VS
>> support 64bit; I do have VS 2005/2008 etc, but I'll probably need to set
>> up a 64bit machine to see if they will install on a 64bit architecture.
>
> For Python 2.6 and later, use VS 2008. This comes with an AMD64
> compiler. You technically don't need a 64-bit Windows, as it supports
> cross-compilation (but you would need a 64-bit Windows to test it).
>
> I personally build Python on a 32-bit machine, and move the MSI to a
> 64-bit machine for testing.
>
OK I've got the VC2008 64bit tools installed on my 32bit build platform, but I'm
getting build errors because of missing libraries. I assume that's because I
don't have the python amd64 runtime libraries/dlls etc etc since the errors are
looking like this
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_Py_FindMethod
referenced in function Box_getattr
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyObject_Init
referenced in function Box
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyObject_Malloc
referenced in function Box
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyList_Type
referenced in function BoxList_init
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_Py_FatalError
referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyType_Ready
referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol __imp_PyType_Type
referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol
__imp_PyModule_AddObject referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol
__imp_PyErr_NewException referenced in function init_rl_accel
_rl_accel.obj : error LNK2019: unresolved external symbol
__imp_Py_InitModule4_64 referenced in function init_rl_accel
build\lib.win-amd64-2.6\_rl_accel.pyd : fatal error LNK1120: 69 unresolved externals
I assume I can get those from a working Python amd64 install and stuff on one of
the compiler paths somehow.
--
Robin Becker
==============================================================================
TOPIC: Reverse engineering CRC?
http://groups.google.com/group/comp.lang.python/t/b22db1e3e63db596?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 3:24 am
From: Gregory Ewing
Lawrence D'Oliveiro wrote:
> They could be using a strong cryptographic hash and truncating it to 16 bits
> or something.
>
> In which case you've got your work cut out for you...
Nope, I've determined that it's actually a pretty standard
CRC, and it's even using one of the standard polynomials,
0x8005. I'll explain the details of how I figured that
out in my essay.
What confused me initially is that it seems to be adding
a few extra bytes to the checked data that aren't present
in the file. Figuring out what they're supposed to contain
is proving to be quite a headache...
--
Greg
==============================================================================
TOPIC: show image in python
http://groups.google.com/group/comp.lang.python/t/028dadaea24719e0?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 3:44 am
From: News123
Philip Semanchuk wrote:
>
> On Mar 10, 2010, at 5:03 PM, mohamed issolah wrote:
>
>> Hey, This is my program
>>
>> 18 def Creeimg():
>> 19 """transforme matrice en image"""
>> 20 img = Image.new ("L",(8,8))
>> 21 matrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
>> 22 img.putdata(matrix)
>> 23 img.show()
>> 24 img.save(fp="./ana.bmp")
>> 25
>>
>> My probeleme : In line 23 "img.show()" Don't work, normally I show the
>> image
Image show is implemented rather half heartedly (at least on linux)
a potential reasons is:
- you didn not install the correct image viewer tool (You should see an
error message though". Then you could try to install the tool, that
python did not find.
depending on the platform, you might have bugs, that don't allow to view
more than one image at a time / etc.
potentially you might be better of by just using
a hand rolled os.system()
or subprocess.Popen call
bye
N
>> but it's not work, but strangely in line 24 "img.save(fp="./ana.bmp")"
>> it's
>> work
>> WHERE IS THE PROBLEME.
>>
>> I have this error in shell : "(eog:3176): GLib-WARNING **: GError set
>> over
>> the top of a previous GError or uninitialized memory.
>> This indicates a bug in someone's code. You must ensure an error is NULL
>> before it's set.
>> The overwriting error message was: Error in getting image file info "
>>
>>
>> os: ubuntu 9.10
>
> Hi issolah,
> I don't know what your problem is but I have a few suggestions --
> 1) You say that img.show() doesn't work. How does it fail? Is that where
> you get the GLib warning?
> 2) I'm glad you posted your code, but because it has line numbers, it's
> awkward to copy & paste into a local example. Please show your code
> without line numbers.
>
> I'm unfamiliar with PIL, so this is just a wild guess, but based on the
> GLib error it seems like you haven't initialized something properly.
> Sorry I couldn't be more helpful. Maybe someone who knows more will answer.
>
> Good luck
> Philip
>
>
>
>
>
==============================================================================
TOPIC: Unicode characters in btye-strings
http://groups.google.com/group/comp.lang.python/t/77271907fb195aca?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 4:35 am
From: Steven D'Aprano
I know this is wrong, but I'm not sure just how wrong it is, or why.
Using Python 2.x:
>>> s = "éâÄ"
>>> print s
éâÄ
>>> len(s)
6
>>> list(s)
['\xc3', '\xa9', '\xc3', '\xa2', '\xc3', '\x84']
Can somebody explain what happens when I put non-ASCII characters into a
non-unicode string? My guess is that the result will depend on the
current encoding of my terminal.
In this case, my terminal is set to UTF-8. If I change it to ISO 8859-1,
and repeat the above, I get this:
>>> list("éâÄ")
['\xe9', '\xe2', '\xc4']
If I do this:
>>> s = u"éâÄ"
>>> s.encode('utf-8')
'\xc3\xa9\xc3\xa2\xc3\x84'
>>> s.encode('iso8859-1')
'\xe9\xe2\xc4'
which at least explains why the bytes have the values which they do.
Thank you,
--
Steven
==============================================================================
TOPIC: Parsing Email Headers
http://groups.google.com/group/comp.lang.python/t/26ed04329c1dc7a7?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 4:59 am
From: Thomas Guettler
T wrote:
> Thanks for your suggestions! Here's what seems to be working - it's
> basically the same thing I originally had, but first checks to see if
> the line is blank
>
> response, lines, bytes = M.retr(i+1)
> # For each line in message
> for line in lines:
> if not line.strip():
> M.dele(i+1)
> break
>
> emailMessage = email.message_from_string(line)
> # Get fields
> fields = emailMessage.keys()
> # If email contains "From" field
> if emailMessage.has_key("From"):
> # Get contents of From field
> from_field = emailMessage.__getitem__("From")
Hi T,
wait, this code looks strange.
You delete the email if it contains an empty line? I use something like this:
message='\n'.join(connection.retr(msg_num)[1])
Your code:
emailMessage = email.message_from_string(line)
create an email object from only *one* line!
You retrieve the whole message (you don't save bandwith), but maybe that's
what you want.
Thomas
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
==============================================================================
TOPIC: Anything like "Effective Java" for Python?
http://groups.google.com/group/comp.lang.python/t/47674ff2d2c78fa6?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 5:07 am
From: Steve Holden
Neo wrote:
> I have learned java for half a year and now I want to learn Python,
> should I learn python 3k or the traditional version?
>
That depends on whether you need to use specific libraries that haven't
yet been ported to Python 3. If so then start with Python 2. If not,
start with 3 - the differences are small enough that you can relatively
easily fall back to 2 if you need to get access to non-ported libraries.
regards
Steve
> On Wed, Mar 10, 2010 at 7:19 AM, kj <no.email@please.post> wrote:
>
>
>
>
> Subject line pretty much says it all: is there a book like "Effective
> Java" for Python. I.e. a book that assumes that readers are
> experienced programmers that already know the basics of the language,
> and want to focus on more advanced programming issues?
>
> ~K
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
==============================================================================
TOPIC: execute bash builtins in python
http://groups.google.com/group/comp.lang.python/t/566f672d7f34e3ab?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 5:15 am
From: Steve Holden
alex goretoy wrote:
> hi,
> i'm trying to write a section of my program that needs to run bash
> builtin alias and declare, i've googled and tried every type of example
> i could find no to avail. this is what I've tried below and it doesn't
> work, is there a way for me to execute a bah builin from python? what i
> need is to take alias output and pipe it to another command with python
> and return the results to a string or list.
>
>>>> p1=Popen(["alias"],stdout=PIPE)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.6/subprocess.py", line 621, in __init__
> errread, errwrite)
> File "/usr/lib/python2.6/subprocess.py", line 1126, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory
>
> if i add shell=True i get empty string and no thins error message
>
>>>> p1=Popen(["alias"],stdout=PIPE,shell=True)
>>>> p1
> <subprocess.Popen object at 0xb7589a4c>
>>>> p1.stdout.read()
> ''
>
> thank you,
> -Alex Goretoy
>
For shell=True I believe you should provide the command as a single
string, not a list of arguments.
>>> p1 = Popen("alias", stdout=PIPE, shell=True)
>>>
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
==============================================================================
TOPIC: Python dos2unix one liner
http://groups.google.com/group/comp.lang.python/t/c4b63debe91d51c7?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 6:13 am
From: Albert van der Horst
In article <hmdlc0$ocq$1@news.eternal-september.org>,
Martin P. Hellwig <martin.hellwig@dcuktec.org> wrote:
>On 02/28/10 11:05, Stefan Behnel wrote:
>> Steven D'Aprano, 28.02.2010 09:48:
>>> There ought to be some kind of competition for the least efficient
>>> solution to programming problems
>>
>> That wouldn't be very interesting. You could just write a code generator
>> that spits out tons of garbage code including a line that solves the
>> problem, and then let it execute the code afterwards. That beast would
>> always win.
>>
>> Stefan
>>
>Well that would be an obvious rule that garbage code that does not
>contribute to the end result (ie can be taken out without affecting the
>end result) would not be allowed. Enforcing the rule is another beast
>though, but I would leave that to the competition.
Thinking of the international obfuscated c contest (iocc).
It is easy to make a mess of a program using the preprocessor.
It is also easy to preprocess then prettyprint the program.
If the result is not obfuscated, it impresses nobody.
Likewise the judges would think nothing of a program with garbage,
and would rate it low, so such rule is unnecessary.
>
>Though the idea of a code generator is solid, but instead of generating
>garbage, produces a virtual machine that implements a generator that
>produces a virtual machine, etc. etc.
That was actually done by Lennart Benschop. He made a Forth program
run by an interpreter written in C.
Although Forthers thought it was straightforward comprehensible
code, it was a winner in the iocc.
>
>--
>mph
Groetjes Albert
--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
==============================================================================
TOPIC: result of os.times() is different with 'time' command Options
http://groups.google.com/group/comp.lang.python/t/ab45c1ed3e45401c?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 5:49 am
From: hiral
Hi,
Python version: 2.6
Script:
def pt(start_time, end_time):
def ptime(time, time_str):
min, sec = divmod(time, 60)
hr, min = divmod(min, 60)
stmt = time_str + '\t'
if hr:
stmt += str(hr) + 'h'
stmt += str(min) + 'm' + str(sec) + 's'
print stmt
if start_time and end_time:
real_time = end_time[4] - start_time[4]
ptime(real_time, "real")
user_time = end_time[0] - start_time[0]
ptime(user_time, "user")
sys_time = end_time[1] - start_time[1]
ptime(sys_time, "sys")
import os, subprocess
cmd = ['ls']
print cmd
t1 = os.times()
subprocess.call(cmd)
t2 = os.times()
pt(t1, t2)
print ".end"
Output:
real 0.0m0.0100000002421s
user 0.0m0.0s
sys 0.0m0.0s
Command:
$ time ls
Output:
real 0m0.007s
user 0m0.000s
sys 0m0.000s
Is this the intended behaviour?
As per the link <http://groups.google.com/group/comp.lang.python/
browse_thread/thread/8032897a30781df/c656a79d4c3268a6> it was fixed in
python 2.5.
Can anybody help.
Thank you.
==============================================================================
TOPIC: python module/utility equivalent to 'time' (linux) and/or 'ntimer'(
Windows)
http://groups.google.com/group/comp.lang.python/t/669dba3b5f181123?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 5:56 am
From: hiral
Hi,
Is there any python module/utility available which would report the
time same as 'time' command in linux and/or report time same as
'ntimer' utility in Windows.
Thank you.
==============================================================================
TOPIC: to create variable from dict
http://groups.google.com/group/comp.lang.python/t/9a2ccf6e5c80789b?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 5:59 am
From: hiral
Hi,
Is there any way to create variables which name matches with dict key?
For example:
dict1 = {"abc":'1", "def":"2"}
Now I am looking to have variable name abc and it's value be '1' etc.
Pl. suggest.
Thank you.
==============================================================================
TOPIC: inspect.stack() and frame
http://groups.google.com/group/comp.lang.python/t/fc8bf697fa9a01a4?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 6:08 am
From: Félix-Antoine Fortin
Thanks Gabriel, you resumed quite well what I did discovered after my
second post
by playing with the garbage collector module.
> (The garbage collector will,
> eventually, break the cycle and free those objects, but not very soon).
I'm not very familiar with the Python garbage collector, so you may
excuse my
simple question, but how can it break the cycle? I guess the object
will be
freed at least when the program ends, but could it be before that? Is
there a
mechanisme in the garbage collector to detect circular references?
Felix
==============================================================================
You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.
To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en
To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com
To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en
To report abuse, send email explaining the problem to abuse@googlegroups.com
==============================================================================
Google Groups: http://groups.google.com/?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home