Hi All,
I apologize for now being specific enough. The testing environment was
actually "django ver. 1.2" which is a CMS based on python codes; so, I
figured it's python related and want to post my question here as well.
Anyway, Here is a more detail about what I have facing now. The java
script
"Kann Vearasilp" wrote
I tested the complete java command via terminal and it worked fine.
The PNG image was created correctly.
So as your user account with your local environment set up, it worked.
I tested the python package using python shell ...
and the PNG image was created
And in y
Hi,
my code is (Python 2.5):
class SomeError(Error):
"""Uff!"""
raise SomeError, "blahblah"
Screen result:
__main__.SomeError: "blahblah"
How can I make "__main__" disappear from output?
Thanks
___
Tutor maillist - Tutor@python.org
To unsubscribe
2011. május 31. 16:39 Japhy Bartlett írta, :
> You could write directly to sys.stderr instead of raising an error.
>
> If other programmers have to work with your code, they'll probably
> find this _incredibly_ annoying.
>
You mean there is no way to write it nicely?
Or are error messages not int
Válas Péter wrote:
Hi,
my code is (Python 2.5):
class SomeError(Error):
"""Uff!"""
raise SomeError, "blahblah"
Screen result:
__main__.SomeError: "blahblah"
I get
Traceback (most recent call last):
File "", line 1, in
NameError: name 'Error' is not defined
How can I make "__main__
Válas Péter wrote:
2011. május 31. 16:39 Japhy Bartlett írta, :
You could write directly to sys.stderr instead of raising an error.
If other programmers have to work with your code, they'll probably
find this _incredibly_ annoying.
You mean there is no way to write it nicely?
Or are error m
2011/5/31 Steven D'Aprano
> You should inherit exceptions from the Exception class:
>
OK, as a matter of fact, it was not Error, it was the own error class of a
bigger program, I just wanted to substitute it with the root object by
heart, and I was wrong, sorry.
> Only built-in exceptions don't
2011/5/31 Steven D'Aprano
>
> Tracebacks are intended to be *useful*, not "nice". Nobody ever said, "Oh
> look, what a pretty error message!
OK, I just saw how nice builtin exceptions were, and went envying them. :-)
___
Tutor maillist - Tutor@pytho
"Válas Péter" wrote
You could write directly to sys.stderr instead of raising an error.
Or better still do both. But only at the top level of your program.
> If other programmers have to work with your code, they'll probably
> find this _incredibly_ annoying.
You mean there is no way to wr
I want to make a program that finds all the prime numbers up to a number
inputed by the user.
I want to know if it is an integer because that will tell me if it is
divisible by that number or not.
* -Hans-*
___
Tutor
On Tue, May 31, 2011 at 5:23 PM, Hans Barkei wrote:
> I want to make a program that finds all the prime numbers up to a number
> inputed by the user.
> I want to know if it is an integer because that will tell me if it is
> divisible by that number or not.
> * -
On Tue, May 31, 2011 at 11:30 PM, Joel Goldstick
wrote:
>
>
> http://stackoverflow.com/questions/1265665/python-check-if-a-string-represents-an-int-without-using-try-except
>
> def RepresentsInt(s):
>
> try:
> int(s)
>
> return True
> except ValueError:
>
> return F
Isn't one of the unsolved millenium prize problems one that includes the
ability to find all of the prime numbers? I'm not sure if your program is
possible if the input number is large.
But to check if a number x is an int, just do this:
x == int(x)
Rachel
On May 31, 2011, at 2:23 PM, Hans
Isn't one of the unsolved millenium prize problems one that includes the
ability to find all of the prime numbers? I'm not sure if your program is
possible if the input number is large.
But to check if a number x is an int, just do this:
x == int(x)
Rachel
On Tue, May 31, 2011 at 2:38 PM, Hug
Isn't one of the unsolved millenium prize problems one that includes the
ability to find all of the prime numbers? I'm not sure if your program is
possible if the input number is large.
But to check if a number x is an int, just do this:
x == int(x)
Rachel
On May 31, 2011, at 2:23 PM, Hans
I think you could also use the type() function. See example below:
if type(yourvar) == int:
#Do stuff here if it is an integer
else:
#Do something here if it is not an integer
Regards
Peter
On 31/05/11 22:23, Hans Barkei wrote:
I want to make a program that finds all the prime numb
On Tue, May 31, 2011 at 11:36 PM, Rachel-Mikel ArceJaeger
wrote:
> Isn't one of the unsolved millenium prize problems one that includes the
> ability to find all of the prime numbers? I'm not sure if your program is
> possible if the input number is large.
> But to check if a number x is an int, j
If prime numbers were finite (an ability to find *all *prime numbers) that
would cause havoc with the fundamental theorem of arithmetic ;)
On Tue, May 31, 2011 at 5:40 PM, Rachel-Mikel ArceJaeger <
arcejae...@gmail.com> wrote:
> Isn't one of the unsolved millenium prize problems one that includes
On Tue, May 31, 2011 at 10:36 PM, Rachel-Mikel ArceJaeger
wrote:
> Isn't one of the unsolved millenium prize problems one that includes the
> ability to find all of the prime numbers? I'm not sure if your program is
> possible if the input number is large.
> But to check if a number x is an int, j
You'll like:
>>> isinstance(1, int)
True
>>> isinstance(1.5, int)
False
There are infinite primes. Proofs abound on the Internet.
But, that's not the problem.
Yes, the problem is possible for any finite number. And it's a nice
little practice problem. Remember that you can skip the testing f
-- Forwarded message --
From: Hugo Arts
Date: Wed, Jun 1, 2011 at 12:01 AM
Subject: Re: [Tutor] checking if a variable is an integer?
To: Peter Lavelle
On Tue, May 31, 2011 at 11:46 PM, Peter Lavelle
wrote:
> I think you could also use the type() function. See example below:
>
Peter Lavelle wrote:
I think you could also use the type() function. See example below:
if type(yourvar) == int:
#Do stuff here if it is an integer
You can do that, but that will miss out on subclasses of int. It is
better to use isinstance(yourvar, int) which will accept an int, or a
s
Rachel-Mikel ArceJaeger wrote:
Isn't one of the unsolved millenium prize problems one that includes the
ability to find all of the prime numbers? I'm not sure if your program is
possible if the input number is large.
Finding all the prime numbers isn't hard. Well, it's not hard if you
have a
"Hans Barkei" wrote
I want to make a program that finds all the prime numbers up to a
number
inputed by the user.
I want to know if it is an integer because that will tell me if it
is
divisible by that number or not.
I assume you meant the result of the division?
If so it is better to us
Hello,
I am having issue in reading a html page which is redirected to a new page.
I get the first warning/error message page and not the redirection one.
Should I request a second time the same url page or Should I loop
forever until the
page content is the correct (by parsing it) one?
Do you
On Wed, Jun 1, 2011 at 1:00 AM, Karim wrote:
>
> Hello,
>
> I am having issue in reading a html page which is redirected to a new page.
> I get the first warning/error message page and not the redirection one.
> Should I request a second time the same url page or Should I loop forever
> until the
On 05/31/2011 04:34 PM, Hugo Arts wrote:
On Wed, Jun 1, 2011 at 1:00 AM, Karim wrote:
Hello,
I am having issue in reading a html page which is redirected to a new page.
I get the first warning/error message page and not the redirection one.
Should I request a second time the same url page or
Hi Karim,
When you hit the page and you get an HTTP redirect code back (say,
302), you will need to make another call to the URL specified in the
"Location" parameter in the response headers. Then you retrieve that
new page and you can check you got an acceptable HTTP response code
(such as 200) a
I don't really understand why __init__.py is necessary -- except that it
makes the packaging scheme work.
The Python Manual by Guido van Rossum and Fred L. Drake says:
... this is done to prevent directories with a common name, such as
string, from unintentionally hiding valid modules that occur
29 matches
Mail list logo