[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Warnings



On Jul 5, 2007, at 8:53 AM, Ian Mallett wrote:

In this case, there are quite a few warnings caused that way. I suppose I can use round() in the future, but my program is already compiled and the work required would be annoying. Is there any other way?

On 7/4/07, Dave LeCompte (really) <dave@xxxxxxxxxxxx> wrote: "Ian Mallett" <geometrian@xxxxxxxxx> wrote:
> Hi,
> After I compile my program with py2exe, and run it, there are warnings;
> like
> "DeprecationWarning: integer argument expected, got float". These are
> just
> warnings, but upon exiting my program a window pops up saying to see the
> log
> file. The log file lists the warnings. Sometimes the window crashes the > game before it has a chance to exit. In short, I would like to get rid of
> the window, as no one needs to see it.  ]

I have found that it is usually not difficult to find the causes of the warnings and cast the float arguments to ints - correcting the problem,
rather than masking the symptoms.

This is probably an especially good idea if I read the implication of the warnings correctly - it is currently deprecated to pass a float in to this function, but in the future, it won't be a warning, it'll be an error. If so, and if you plan to maintain the code you're working on, you'll have to
call the complaining function with integer arguments anyway.

Assuming they use the python warning framework, this should be helpful to you:

http://www.python.org/dev/peps/pep-0230/

In particular the -Wignore command line option.

However I would tend to agree with Dave here that suppressing the warnings is not the best option. And using round() will not help you, since round() still returns a float which is what the warnings are complaining about, you need to use int() to get rid of them.

hth,

-Casey