comp.lang.python - 25 new messages in 12 topics - digest
comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en
comp.lang.python@googlegroups.com
Today's topics:
* Terminating threaded programs - 3 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/3faf7257442cb33f?hl=en
* Is a merge interval function available? - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/028e0e78c5df5168?hl=en
* Need debugging knowhow for my creeping Unicodephobia - 4 messages, 4 authors
http://groups.google.com/group/comp.lang.python/t/f468546c655f085f?hl=en
* calculating a string equation - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/12094901cfa73511?hl=en
* Modifying Class Object - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/fd36962c4970ac48?hl=en
* python crash on windows but not on linux - 5 messages, 4 authors
http://groups.google.com/group/comp.lang.python/t/7d380bb24fe5e8b8?hl=en
* come and join www.pakdub.com a social network with full features like games,
classifieds, forums, blogs and a lot more - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/df20d96ac6449045?hl=en
* Bizarre arithmetic results - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/a84e4f9c6dcb911a?hl=en
* python and http POST - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/1a0a110a19fdcf4f?hl=en
* MODULE FOR I, P FRAME - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/b7f6043c2bc81cab?hl=en
* Please help with MemoryError - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/6ed1981bc9821443?hl=en
* Function attributes - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/73a7dac9c913c91c?hl=en
==============================================================================
TOPIC: Terminating threaded programs
http://groups.google.com/group/comp.lang.python/t/3faf7257442cb33f?hl=en
==============================================================================
== 1 of 3 ==
Date: Thurs, Feb 11 2010 12:17 pm
From: mk
Stephen Hansen wrote:
> I use threads all the time (well, for certain types of workloads) and
> have never seen this.
>
> Are your threads daemon threads? The only time I've seen sys.exit() not
> close out my program is when I'm launching non-daemon threads on accident.
The snag is that my program is using calls to another threaded library
(paramiko) which does lots of stuff with sockets and communication
(SSH). Paramiko in turn calls Crypto which has compiled C extensions. I
really don't know what's going on in there, just guessing that this
might trigger this behavior.
> Now, I do get some slightly random errors on close due to threads doing
> stuff or returning from doing stuff while the shutdown procedure is
> going on, but I don't really care, cuz, well, I'm shutting everything
> down and nothing worth knowing is going on in the rest of the program.
Same as me, except I get lots of exceptions in threads if I shut down
with sys.exit. SIGTERM somehow gets around this problem.
I'll try os._exit.
Regards,
mk
== 2 of 3 ==
Date: Thurs, Feb 11 2010 12:18 pm
From: mk
Aahz wrote:
> You can also use os._exit().
Thanks!
== 3 of 3 ==
Date: Thurs, Feb 11 2010 12:22 pm
From: mk
Aahz wrote:
> You can also use os._exit().
Yes! It works cleanly! Thanks a million!
OTOH, if I use sys.exit(), it's just hanging there.
Regards,
mk
==============================================================================
TOPIC: Is a merge interval function available?
http://groups.google.com/group/comp.lang.python/t/028e0e78c5df5168?hl=en
==============================================================================
== 1 of 3 ==
Date: Thurs, Feb 11 2010 1:03 pm
From: Jonathan Gardner
On Feb 10, 3:23 pm, Peng Yu <pengyu...@gmail.com> wrote:
> I'm wondering there is already a function in python library that can
> merge intervals. For example, if I have the following intervals ('['
> and ']' means closed interval as inhttp://en.wikipedia.org/wiki/Interval_(mathematics)#Excluding_the_end...)
>
> [1, 3]
> [2, 9]
> [10,13]
> [11,12]
>
> I want to get the following merged intervals.
>
> [1,9]
> [10,13]
>
> Could somebody let me know if there is a function in the python
> library?
I vaguely recall a similar question a long time ago. Peng, is this a
homework assignment?
Perhaps we should add a standard module called "homework". It can have
functions for all the different homework assignments we see on
c.l.python. We can simply point people to this module and then can
include the code in their answers.
== 2 of 3 ==
Date: Thurs, Feb 11 2010 1:37 pm
From: "Alf P. Steinbach"
* Jonathan Gardner:
> On Feb 10, 3:23 pm, Peng Yu <pengyu...@gmail.com> wrote:
>> I'm wondering there is already a function in python library that can
>> merge intervals. For example, if I have the following intervals ('['
>> and ']' means closed interval as inhttp://en.wikipedia.org/wiki/Interval_(mathematics)#Excluding_the_end...)
>>
>> [1, 3]
>> [2, 9]
>> [10,13]
>> [11,12]
>>
>> I want to get the following merged intervals.
>>
>> [1,9]
>> [10,13]
>>
>> Could somebody let me know if there is a function in the python
>> library?
>
> I vaguely recall a similar question a long time ago. Peng, is this a
> homework assignment?
>
> Perhaps we should add a standard module called "homework". It can have
> functions for all the different homework assignments we see on
> c.l.python. We can simply point people to this module and then can
> include the code in their answers.
If it's possible, there was/is this guy over in clc.c++ who responded/responds
to homework questions with the most advanced, convoluted and, except for
misleading names, technically correct solutions.
Cheers,
- Alf
== 3 of 3 ==
Date: Thurs, Feb 11 2010 3:26 pm
From: Peter
On Feb 12, 8:03 am, Jonathan Gardner <jgard...@jonathangardner.net>
wrote:
> On Feb 10, 3:23 pm, Peng Yu <pengyu...@gmail.com> wrote:
>
>
>
>
>
> > I'm wondering there is already a function in python library that can
> > merge intervals. For example, if I have the following intervals ('['
> > and ']' means closed interval as inhttp://en.wikipedia.org/wiki/Interval_(mathematics)#Excluding_the_end...)
>
> > [1, 3]
> > [2, 9]
> > [10,13]
> > [11,12]
>
> > I want to get the following merged intervals.
>
> > [1,9]
> > [10,13]
>
> > Could somebody let me know if there is a function in the python
> > library?
>
> I vaguely recall a similar question a long time ago. Peng, is this a
> homework assignment?
>
> Perhaps we should add a standard module called "homework". It can have
> functions for all the different homework assignments we see on
> c.l.python. We can simply point people to this module and then can
> include the code in their answers.
Good idea - that would (also) give the teachers a convenient place to
check for what assignments have been solved by this list so they can
propose something else.
They can also grade the submissions against the code kept in this area
- exact copies could receive an "F" (for example :-))
Peter
==============================================================================
TOPIC: Need debugging knowhow for my creeping Unicodephobia
http://groups.google.com/group/comp.lang.python/t/f468546c655f085f?hl=en
==============================================================================
== 1 of 4 ==
Date: Thurs, Feb 11 2010 1:43 pm
From: mk
MRAB wrote:
> When working with Unicode in Python 2, you should use the 'unicode' type
> for text (Unicode strings) and limit the 'str' type to binary data
> (bytestrings, ie bytes) only.
Well OK, always use u'something', that's simple -- but isn't str what I
get from files and sockets and the like?
> In Python 3 they've been renamed to 'str' for Unicode _strings_ and
> 'bytes' for binary data (bytes!).
Neat, except that the process of porting most projects and external
libraries to P3 seems to be, how should I put it, standing still? Or am
I wrong? But that's the impression I get?
Take web frameworks for example. Does any of them have serious plans and
work in place to port to P3?
> Strictly speaking, only Unicode can be encoded.
How so? Can't bytestrings containing characters of, say, koi8r encoding
be encoded?
> What Python 2 is doing here is trying to be helpful: if it's already a
> bytestring then decode it first to Unicode and then re-encode it to a
> bytestring.
It's really cumbersome sometimes, even if two libraries are written by
one author: for instance, Mako and SQLAlchemy are written by the same
guy. They are both top-of-the line in my humble opinion, but when you
connect them you get things like this:
1. you query SQLAlchemy object, that happens to have string fields in
relational DB.
2. Corresponding Python attributes of those objects then have type str,
not unicode.
3. then I pass those objects to Mako for HTML rendering.
Typically, it works: but if and only if a character in there does not
happen to be out of ASCII range. If it does, you get UnicodeDecodeError
on an unsuspecting user.
Sure, I wrote myself a helper that iterates over keyword dictionary to
make sure to convert all str to unicode and only then passes the
dictionary to render_unicode. It's an overhead, though. It would be
nicer to have it all unicode from db and then just pass it for rendering
and having it working. (unless there's something in filters that I
missed, but there's encoding of templates, tags, but I didn't find
anything on automatic conversion of objects passed to method rendering
template)
But maybe I'm whining.
> Unfortunately, the default encoding is ASCII, and the bytestring isn't
> valid ASCII. Python 2 is being 'helpful' in a bad way!
And the default encoding is coded in such way so it cannot be changed in
sitecustomize (without code modification, that is).
Regards,
mk
== 2 of 4 ==
Date: Thurs, Feb 11 2010 1:48 pm
From: Robert Kern
On 2010-02-11 15:43 PM, mk wrote:
> MRAB wrote:
>> Strictly speaking, only Unicode can be encoded.
>
> How so? Can't bytestrings containing characters of, say, koi8r encoding
> be encoded?
I think he means that only unicode objects can be encoded using the .encode()
method, as clarified by his next sentence:
>> What Python 2 is doing here is trying to be helpful: if it's already a
>> bytestring then decode it first to Unicode and then re-encode it to a
>> bytestring.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
== 3 of 4 ==
Date: Thurs, Feb 11 2010 2:36 pm
From: Steve Holden
mk wrote:
> MRAB wrote:
>
>> When working with Unicode in Python 2, you should use the 'unicode' type
>> for text (Unicode strings) and limit the 'str' type to binary data
>> (bytestrings, ie bytes) only.
>
> Well OK, always use u'something', that's simple -- but isn't str what I
> get from files and sockets and the like?
>
Yes, which is why you need to know what encoding was used to create it.
>> In Python 3 they've been renamed to 'str' for Unicode _strings_ and
>> 'bytes' for binary data (bytes!).
>
> Neat, except that the process of porting most projects and external
> libraries to P3 seems to be, how should I put it, standing still? Or am
> I wrong? But that's the impression I get?
>
No, it's probably not going as quickly as you would like, but it's
certainly not standing still. Some of these libraries are substantial
works, and there were changes to the C API that take quite a bit of work
to adapt existing code to.
> Take web frameworks for example. Does any of them have serious plans and
> work in place to port to P3?
>
There have already been demonstrations of partially-working Python 3
Django. I can't speak to the rest.
>> Strictly speaking, only Unicode can be encoded.
>
> How so? Can't bytestrings containing characters of, say, koi8r encoding
> be encoded?
>
It's just terminology. If a bytestring contains koi8r characters then
(as you unconsciously recognized by your use of the word "encoding") it
already *has* been encoded.
>> What Python 2 is doing here is trying to be helpful: if it's already a
>> bytestring then decode it first to Unicode and then re-encode it to a
>> bytestring.
>
> It's really cumbersome sometimes, even if two libraries are written by
> one author: for instance, Mako and SQLAlchemy are written by the same
> guy. They are both top-of-the line in my humble opinion, but when you
> connect them you get things like this:
>
> 1. you query SQLAlchemy object, that happens to have string fields in
> relational DB.
>
> 2. Corresponding Python attributes of those objects then have type str,
> not unicode.
>
Yes, a relational database will often return ASCII, but nowadays people
are increasingly using encoded Unicode. In that case you need to be
aware of the encoding that has been used to render the Unicode values
into the byte strings (which in Python 2 are of type str) so that you
can decode them into Unicode.
> 3. then I pass those objects to Mako for HTML rendering.
>
> Typically, it works: but if and only if a character in there does not
> happen to be out of ASCII range. If it does, you get UnicodeDecodeError
> on an unsuspecting user.
>
Well first you need to be clear what you are passing to Mako.
> Sure, I wrote myself a helper that iterates over keyword dictionary to
> make sure to convert all str to unicode and only then passes the
> dictionary to render_unicode. It's an overhead, though. It would be
> nicer to have it all unicode from db and then just pass it for rendering
> and having it working. (unless there's something in filters that I
> missed, but there's encoding of templates, tags, but I didn't find
> anything on automatic conversion of objects passed to method rendering
> template)
>
Some database modules will distinguish between fields of type varchar
and nvarchar, returning Unicode objects for the latter. You will need to
ensure that the module knows which encoding is used in the database.
This is usually automatic.
> But maybe I'm whining.
>
Nope, just struggling with a topic that is far from straightforward the
first time you encounter it.
>
>> Unfortunately, the default encoding is ASCII, and the bytestring isn't
>> valid ASCII. Python 2 is being 'helpful' in a bad way!
>
> And the default encoding is coded in such way so it cannot be changed in
> sitecustomize (without code modification, that is).
>
Yes, the default encoding is not always convenient.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
== 4 of 4 ==
Date: Thurs, Feb 11 2010 3:34 pm
From: Terry Reedy
On 2/11/2010 4:43 PM, mk wrote:
> Neat, except that the process of porting most projects and external
> libraries to P3 seems to be, how should I put it, standing still?
What is important are the libraries, so more new projects can start in
3.x. There is a slow trickly of 3.x support announcements.
> But maybe I'm whining.
Or perhaps explaining why 3.x unicode improvements are needed.
tjr
==============================================================================
TOPIC: calculating a string equation
http://groups.google.com/group/comp.lang.python/t/12094901cfa73511?hl=en
==============================================================================
== 1 of 2 ==
Date: Thurs, Feb 11 2010 1:43 pm
From: Astan Chee
Hi,
I have some variables in my script that looks like this:
vars = {'var_a':'10','var_b':'4'}
eqat = "(var_a/2.0) <= var_b"
result = "(var_a+var_b)/7"
What I'm trying to do is to plug in var_a and var_b's values from vars
into eqat and see if eqat returns true or false as well as getting the
value of result if these variables were "plugged in". How do I do this?
I'm also expecting eqat and result to contain various python
mathematical operators like **, and compounded ()'s.
I'm not sure how to convert the equation; if I have to make a bunch of
if-statements or if there is a python function that already does
something like this.
Thanks for any help.
Cheers
Astan
== 2 of 2 ==
Date: Thurs, Feb 11 2010 1:50 pm
From: Arnaud Delobelle
Astan Chee <astan.chee@al.com.au> writes:
> Hi,
> I have some variables in my script that looks like this:
> vars = {'var_a':'10','var_b':'4'}
> eqat = "(var_a/2.0) <= var_b"
> result = "(var_a+var_b)/7"
> What I'm trying to do is to plug in var_a and var_b's values from vars
> into eqat and see if eqat returns true or false as well as getting the
> value of result if these variables were "plugged in". How do I do
> this?
> I'm also expecting eqat and result to contain various python
> mathematical operators like **, and compounded ()'s.
> I'm not sure how to convert the equation; if I have to make a bunch of
> if-statements or if there is a python function that already does
> something like this.
Yes: eval()
>>> vars = {'var_a':10 ,'var_b':4}
>>> eqat = "(var_a/2.0) <= var_b"
>>> result = "(var_a+var_b)/7"
>>> eval(eqat, vars)
False
>>> eval(result, vars)
2
(Note that I have slightly modified your vars dictionary)
See a recent thread about the dangers of eval().
--
Arnaud
==============================================================================
TOPIC: Modifying Class Object
http://groups.google.com/group/comp.lang.python/t/fd36962c4970ac48?hl=en
==============================================================================
== 1 of 2 ==
Date: Thurs, Feb 11 2010 2:11 pm
From: Terry Reedy
On 2/11/2010 1:37 AM, Alf P. Steinbach wrote:
> Consider just the
> assert( t is not s )
> t = s
>
> Does this change anything at all in the computer's memory?
By 'computer', do you mean 'anything that computes' (including humans)
or specifically 'electronic computer'?
> But since it does have an effect, a memory change has been effected.
Agreed, in whatever 'memory' the 'computer' is using.
> You describe that memory change as that t has been "bound" to the same
> object as s.
I prefer to use the word 'associated': namespaces are a many-to-one
association between names and objects.
> By which you mean that henceforth, until the next assignment to t, t
> *refers* to the same object as s.
T and s are both associated with the same object.
> That explanation in terms of "refers" is necessary.
I disagree
> No beginner knows what it means that a name is "bound" to something means, until it's been
> explained.
I agree, which is why I am trying to avoid 'bound', etc, in favor of
'associated'. One problem of 'bind' is that it sometimes raises the
question of which is bound to which. 'Associated' avoids that.
> The explanation is necessarily in terms of "refers to".
I have given an alternative, even if you still prefer yours.
> When something A refers to something B, then by definition A is a
> *reference* to B.
I presume you agree that the name 'Alf P. Steinbach' refers to you. Do
you then consider it to be a 'reference' to you? In either case, the
Python definition uses 'refers to' in the same way that names refer to
people, and did even before names were used in electro-mechanical
computer programming.
>Steven D'Aprano:
>> My version describes what happens at the level of high-level Python
>> code, which is the defined semantics of the language. It makes no
>> assumptions about the implementation, completely unlike yours which is
>> entirely implementation-
>> specific. My description is equally valid whether Python is being
>> executed by the CPython virtual machine on an Intel-compatible
>> processor, or hand-simulated with pencil and paper, or something
>> completely different. Yours is not.
About 13 years ago, I noticed that electronically executable Python was
very similar to some of the designed-for-human-reading algoritm
languages (pseudocode) that were not. I then coined the oxymoron
'executable pseudocode' for Python. I see the difference between the
descriptions as reflecting the difference between Python, the executable
algorithm language and Python, the machine programming language.
>> I describe the high-level language, you describe one implementation.
>> Neither view is *wrong*, per se, but one describes the semantics of
>> the language while the other describes the implementation.
I think anyone writing books using Python should at least understand the
abstract view even if he prefers to write from the more concrete view.
Terry Jan Reedy
== 2 of 2 ==
Date: Thurs, Feb 11 2010 2:26 pm
From: "Alf P. Steinbach"
* Terry Reedy:
> On 2/11/2010 1:37 AM, Alf P. Steinbach wrote:
>
>> Consider just the
>> assert( t is not s )
>> t = s
>>
>> Does this change anything at all in the computer's memory?
>
> By 'computer', do you mean 'anything that computes' (including humans)
> or specifically 'electronic computer'?
In this context I mean the virtual machine that a Python language assumes.
Doesn't matter if it's electronic or a pen-and-pencil simulation.
>> But since it does have an effect, a memory change has been effected.
>
> Agreed, in whatever 'memory' the 'computer' is using.
>
>> You describe that memory change as that t has been "bound" to the same
>> object as s.
>
> I prefer to use the word 'associated': namespaces are a many-to-one
> association between names and objects.
>
>> By which you mean that henceforth, until the next assignment to t, t
>> *refers* to the same object as s.
>
> T and s are both associated with the same object.
>
>> That explanation in terms of "refers" is necessary.
>
> I disagree
>
>> No beginner knows what it means that a name is "bound" to something
>> means, until it's been
>> explained.
>
> I agree, which is why I am trying to avoid 'bound', etc, in favor of
> 'associated'. One problem of 'bind' is that it sometimes raises the
> question of which is bound to which. 'Associated' avoids that.
>
>> The explanation is necessarily in terms of "refers to".
>
> I have given an alternative, even if you still prefer yours.
"Associated" is just less precise than "refers".
"Associated" is two-way.
Anyway it's just a term, and if you define it to mean a one-way reference, then
nothing substantial is changed except more room for misunderstanding.
>> When something A refers to something B, then by definition A is a
>> *reference* to B.
>
> I presume you agree that the name 'Alf P. Steinbach' refers to you. Do
> you then consider it to be a 'reference' to you?
Yes, and that's irrelevant, because you can't change a name. It's a slightly
different meaning. But a name edit field with my name in it most probably refers
to me.
> In either case, the
> Python definition uses 'refers to' in the same way that names refer to
> people, and did even before names were used in electro-mechanical
> computer programming.
That's so subtle a distinction that it appears meaningless to me.
It says "refers to" but doesn't mean "refers to"?
> >Steven D'Aprano:
>>> My version describes what happens at the level of high-level Python
>>> code, which is the defined semantics of the language. It makes no
>>> assumptions about the implementation, completely unlike yours which is
>>> entirely implementation-
>>> specific. My description is equally valid whether Python is being
>>> executed by the CPython virtual machine on an Intel-compatible
>>> processor, or hand-simulated with pencil and paper, or something
>>> completely different. Yours is not.
>
> About 13 years ago, I noticed that electronically executable Python was
> very similar to some of the designed-for-human-reading algoritm
> languages (pseudocode) that were not. I then coined the oxymoron
> 'executable pseudocode' for Python. I see the difference between the
> descriptions as reflecting the difference between Python, the executable
> algorithm language and Python, the machine programming language.
>
> >> I describe the high-level language, you describe one implementation.
> >> Neither view is *wrong*, per se, but one describes the semantics of
> >> the language while the other describes the implementation.
>
> I think anyone writing books using Python should at least understand the
> abstract view even if he prefers to write from the more concrete view.
It seems to me that you lack an understanding of the abstract here, going into
imagined and not concretely discussed differences between "refers to" and
"refers to".
Until or if (but I think it unlikely) you can explain clearly what that
difference between "refers to" and "refers to" is, it's just wordplay.
Cheers & hth.,
- Alf
==============================================================================
TOPIC: python crash on windows but not on linux
http://groups.google.com/group/comp.lang.python/t/7d380bb24fe5e8b8?hl=en
==============================================================================
== 1 of 5 ==
Date: Thurs, Feb 11 2010 2:39 pm
From: hjebbers
On Feb 11, 8:42 pm, Jerry Hill <malaclyp...@gmail.com> wrote:
> On Thu, Feb 11, 2010 at 9:32 AM, hjebbers <hjebb...@gmail.com> wrote:
> > To all,
> > I am running an EDI translator, and doing stress tests.
> > When processing a test with a (relatively) big EDI file(s) on
> > windowsXP I get a crash:
> > 'sorry for the inconvenience' etc (so no clues about what is
> > causing the problem)
>
> You need to give us more information if we're going to be able to
> help. At the very least, you'll need to copy & paste the actual error
> message. It would be even better if you could show us some of your
> code, and better yet if you could give us a small bit of code that is
> self contained and reproduces the problem you're experiencing.
>
> --
> Jerry
the error is a windows thing, I can make a screenshot of it, but I can
not copy/paste text.
how do I upload a png-file?
problem is that the same error happens over and over (I can reproduce
it), but not at the same place (the is a logging in the application so
that is quite easy to see.)
but ....I can show you my code. it's an open source EDI application.
but it is not a small bit of code....
I am more than will to show you how to reproduce the error.
kind regards,
henk-jan
== 2 of 5 ==
Date: Thurs, Feb 11 2010 2:39 pm
From: hjebbers
On Feb 11, 8:42 pm, Jerry Hill <malaclyp...@gmail.com> wrote:
> On Thu, Feb 11, 2010 at 9:32 AM, hjebbers <hjebb...@gmail.com> wrote:
> > To all,
> > I am running an EDI translator, and doing stress tests.
> > When processing a test with a (relatively) big EDI file(s) on
> > windowsXP I get a crash:
> > 'sorry for the inconvenience' etc (so no clues about what is
> > causing the problem)
>
> You need to give us more information if we're going to be able to
> help. At the very least, you'll need to copy & paste the actual error
> message. It would be even better if you could show us some of your
> code, and better yet if you could give us a small bit of code that is
> self contained and reproduces the problem you're experiencing.
>
> --
> Jerry
the error is a windows thing, I can make a screenshot of it, but I can
not copy/paste text.
how do I upload a png-file?
problem is that the same error happens over and over (I can reproduce
it), but not at the same place (the is a logging in the application so
that is quite easy to see.)
but ....I can show you my code. it's an open source EDI application.
but it is not a small bit of code....
I am more than will to show you how to reproduce the error.
kind regards,
henk-jan
== 3 of 5 ==
Date: Thurs, Feb 11 2010 2:56 pm
From: Carl Banks
On Feb 11, 2:39 pm, hjebbers <hjebb...@gmail.com> wrote:
> On Feb 11, 8:42 pm, Jerry Hill <malaclyp...@gmail.com> wrote:
>
>
>
>
>
> > On Thu, Feb 11, 2010 at 9:32 AM, hjebbers <hjebb...@gmail.com> wrote:
> > > To all,
> > > I am running an EDI translator, and doing stress tests.
> > > When processing a test with a (relatively) big EDI file(s) on
> > > windowsXP I get a crash:
> > > 'sorry for the inconvenience' etc (so no clues about what is
> > > causing the problem)
>
> > You need to give us more information if we're going to be able to
> > help. At the very least, you'll need to copy & paste the actual error
> > message. It would be even better if you could show us some of your
> > code, and better yet if you could give us a small bit of code that is
> > self contained and reproduces the problem you're experiencing.
>
> > --
> > Jerry
>
> the error is a windows thing, I can make a screenshot of it, but I can
> not copy/paste text.
> how do I upload a png-file?
>
> problem is that the same error happens over and over (I can reproduce
> it), but not at the same place (the is a logging in the application so
> that is quite easy to see.)
> but ....I can show you my code. it's an open source EDI application.
> but it is not a small bit of code....
> I am more than will to show you how to reproduce the error.
People coming here ask for help will vary in the amount of detail
given, but I've rarely seen anyone as reluctant as you. It's like
walking into an auto repair shop and asking the mechanic what's wrong
with your car by trying to imitate the noise it makes.
If your code is very largre, you're not going to get out of this
without doing some of your own legwork. I'm sorry.
Do this: Take your code, make a copy of it. Start removing code from
the copy (in a controlled way) until the problem disappears. When you
remove code don't worry about whether it produces anything useful, the
object is to try to identify what's causing the error. Whatever code
you removed when the error disappears should give you a clue what's
causing it. Then, if need be, you can come back and post details. If
you manage to get the program to a small size without eliminating the
problem, you can post it here.
Carl Banks
== 4 of 5 ==
Date: Thurs, Feb 11 2010 2:59 pm
From: Terry Reedy
On 2/11/2010 9:32 AM, hjebbers wrote:
> To all,
> I am running an EDI translator, and doing stress tests.
> When processing a test with a (relatively) big EDI file(s) on
> windowsXP I get a crash:
> 'sorry for the inconvenience' etc (so no clues about what is
> causing the problem)
>
> This happens with python 2.4, 2.5, 2.6
> It does not happen in the same setup&tests on linux. (while the linux
> machine has only half of the RAM of the windows machine).
> I am quite sure it is not some external module; there's no GUI (apart
> from 'print'), no network connections.
> Actually, the crash is not predictable....the crash occurs most of the
> time...but at different points.
>
> So basically I am wondering how to proceed.
> Is it related to a memory problem? (which does not occur on Linux)
>
> any pointer is very welcome,
Are you using a 3rd-party extension (compiled-C) module? If so, I would
suspect something platform specific in that.
== 5 of 5 ==
Date: Thurs, Feb 11 2010 3:13 pm
From: Emile van Sebille
On 2/11/2010 6:32 AM hjebbers said...
> To all,
> I am running an EDI translator,
... let's say bots :)
> and doing stress tests.
> When processing a test with a (relatively) big EDI file(s) on
> windowsXP I get a crash:
> 'sorry for the inconvenience' etc (so no clues about what is
> causing the problem)
... and it's running directly under python...
I use textpad. It allows me to launch a script from a command window
under its control, which when python subsequently crashes, commonly
leaves the traceback in the textpad launched command window.
Perhaps that'll help?
Emile
--also on the bots list and will be digging in seriously over the next
several weeks
>
> This happens with python 2.4, 2.5, 2.6
> It does not happen in the same setup&tests on linux. (while the linux
> machine has only half of the RAM of the windows machine).
> I am quite sure it is not some external module; there's no GUI (apart
> from 'print'), no network connections.
> Actually, the crash is not predictable....the crash occurs most of the
> time...but at different points.
>
> So basically I am wondering how to proceed.
> Is it related to a memory problem? (which does not occur on Linux)
>
> any pointer is very welcome,
>
> henk-jan
==============================================================================
TOPIC: come and join www.pakdub.com a social network with full features like
games, classifieds, forums, blogs and a lot more
http://groups.google.com/group/comp.lang.python/t/df20d96ac6449045?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 11 2010 2:44 pm
From: babu lohar
come and join www.pakdub.com a social network with full features like
games, classifieds, forums, blogs and a lot more
==============================================================================
TOPIC: Bizarre arithmetic results
http://groups.google.com/group/comp.lang.python/t/a84e4f9c6dcb911a?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 11 2010 2:52 pm
From: Terry Reedy
On 2/11/2010 11:23 AM, Jussi Piitulainen wrote:
> Robert Kern writes:
>> On 2010-02-11 06:31 AM, Shashwat Anand wrote:
>>> There is a little issue here that '>>> -.1 ** .1' should give you
>>> error message. That is it.
>>
>> No, fractional powers of negative numbers are perfectly valid
>> mathematically. The result is a complex number. In Python 3 (what
>> the OP is using), this has been implemented, but not in Python 2.6.
>
> Perhaps it should raise a MisleadingSpacingError at compile time.
You forgot the smiley ;-).
> The error message could recommend - .1**.1, or better -(.1 ** .1).
The compiler would never see the difference between -.1 ** .1 and the
first and probably no difference with the second either.
==============================================================================
TOPIC: python and http POST
http://groups.google.com/group/comp.lang.python/t/1a0a110a19fdcf4f?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 11 2010 3:20 pm
From: Terry Reedy
On 2/11/2010 2:11 PM, galileo228 wrote:
> Hey All,
>
> Been teaching myself Python for a few weeks, and am trying to write a
> program that will go to a url, enter a string in one of the search
> fields, submit the search, and return the contents of the search
> result.
>
> I'm using httplib2.
>
> My two particular questions:
>
> 1) When I set my 'body' var, (i.e. 'body = {'query':'search_term'}),
> how do I know what the particular key should be? In other words, how
> do I tell python which form on the web page I'm visiting I'd like to
> fill in? Do I simply go to the webpage itself and look at the html
> source? But if that's the case, which tag tells me the name of the
> key?
>
> 2) Even once python fills in the form properly, how can I tell it to
> 'submit' the search?
This
http://groups.csail.mit.edu/uid/sikuli/
*might* help you.
==============================================================================
TOPIC: MODULE FOR I, P FRAME
http://groups.google.com/group/comp.lang.python/t/b7f6043c2bc81cab?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 11 2010 3:32 pm
From: "Rhodri James"
On Thu, 11 Feb 2010 19:31:52 -0000, DANNY <danijel.gvero@gmail.com> wrote:
> Hello!
>
> I am currently developing a simple video player in python, and my
> problem is that i can't find a module which has a function that can
> determine if frame(image) is I or P coded (MPEG coding). I have been
> using PIL but I couldnt find anything that could help me with that
> problem.
How are you reading the video? PIL doesn't claim to do more than identify
MPEG files. Also, which MPEG encoding, in which container format?
If you aren't just putting a wrapper around something like ffmpeg, I
rather suspect you'll have to decode the bitstream yourself. That could
be rather painful if you're talking about MPEG-4/10.
--
Rhodri James *-* Wildebeeste Herder to the Masses
==============================================================================
TOPIC: Please help with MemoryError
http://groups.google.com/group/comp.lang.python/t/6ed1981bc9821443?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 11 2010 3:39 pm
From: Jeremy
I have been using Python for several years now and have never run into
memory errors…
until now.
My Python program now consumes over 2 GB of memory and then I get a
MemoryError. I know I am reading lots of files into memory, but not
2GB worth. I thought I didn't have to worry about memory allocation
in Python because of the garbage collector. On this note I have a few
questions. FYI I am using Python 2.6.4 on my Mac.
1. When I pass a variable to the constructor of a class does it
copy that variable or is it just a reference/pointer? I was under the
impression that it was just a pointer to the data.
2. When do I need to manually allocate/deallocate memory and when
can I trust Python to take care of it?
3. Any good practice suggestions?
Thanks,
Jeremy
==============================================================================
TOPIC: Function attributes
http://groups.google.com/group/comp.lang.python/t/73a7dac9c913c91c?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 11 2010 3:36 pm
From: "Gabriel Genellina"
En Thu, 11 Feb 2010 00:25:00 -0300, Terry Reedy <tjreedy@udel.edu>
escribió:
> On 2/10/2010 4:49 PM, Gabriel Genellina wrote:
>
>> I've written a decorator for "injecting" a __function__ name into the
>> function namespace, but I can't find it anywhere. I think I implemented
>> it by adding a fake additional argument and replacing LOAD_GLOBAL with
>> LOAD_NAME in the bytecode.
>
> The decorator only needs to replace the defaults args tuple.
> It does not even need to know the parameter name,
> just that it is the only (or last) with a default .
>
> def f(n, me=None):
> if n > 0: return n*me(n-1)
> elif n==0: return 1
>
> f.__defaults__ = (f,) # 3.1
> print(f(5))
This is simple to implement, but requires changing the function
definition. My goal was to keep the original code unchanged, that is,
leave it as:
def f(n):
if n > 0: return n*f(n-1)
elif n==0: return 1
(like a normal, recursive function), and make the 'f' inside the function
body "magically" refer to the function itself.
> Of course, user could still screw up recursion by providing another
> value for 'me'. This strikes me as about a likely (low) as a user
> screwing up recursion in a library module function by rebinding the name
> in the imported module.
Well, if people really want to shoot themselves in the foot, there's
nothing we can do to avoid that...
--
Gabriel Genellina
==============================================================================
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