472,096 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

Question about FutureWarning

I have module M1 which has the following line in it:

StartTime = safe_dict_get ( dic, 'starttime', 0xFFFFFFFF )

It gets imported by modules M2 and M3. And finally, M4 imports both M2 and
M3.

M4
|\M3
| |\M1
|\M2
| |\M1

I'm building a .deb file which means I have to compile the modules into
..pyc and .pyo files.

The compile command I use is

python=/usr/bin/python2.3
i_python ()
{
$python -c "import $1"
$python -O -c "import $1"
}
i_python M1
i_python M2
i_python M3
i_python M4

When M1 is compiled, there's no problem. The same for when I compile M2
and M3. But when M4 is compiled, I get the following message:

M1.py:268: FutureWarning: hex/oct constants sys.maxint will
return positive values in Python 2.4 and up
StartTime = safe_dict_get ( dic, 'starttime', 0xFFFFFFFF )

I get the message twice, ostensibly because of M3 and M2.

I was able to shut off the warning by adding the following lines *before*
the import in M4.

import warnings
warnings.filterwarnings('ignore', category=FutureWarning)

My question is this: Why can the warning not be shut off by putting the
two lines in M1?

TIA

--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
Aug 14 '07 #1
0 915

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Egor Bolonev | last post: by
8 posts views Thread by Grant Edwards | last post: by
reply views Thread by Chris Curvey | last post: by
14 posts views Thread by kosuke | last post: by
3 posts views Thread by Stevey | last post: by
5 posts views Thread by Steven W. Orr | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.