mx Oddity in FC3/RedHat ES

Eric Azarcon junk at azarcon.com
Mon Dec 20 16:29:58 CET 2004


In article <dNBxd.57044$Jk5.33616 at lakeread01>, Steve Holden
<steve at holdenweb.com> wrote:

>    from anything import *
> 
> is bad form for any module unless (like Tkinter, for example) it's been 

Ah, I see. Thank you. Is there any reference, or way for me to
determine whether something can/should be imported in this manner? As a
newbie, looking for this information is sorta tough. I only used 
  from mx import *
because i found a reference to doing it this way elsewhere on the web.

I also use from stat import * to get at the ST_CTIME constant. Is that
a module that supports this, or is there a better way?

>   >>> import mx.DateTime as dt
>   >>> dt.today()
> <DateTime object for '2004-12-20 00:00:00.00' at a0d85e0>

Awesome! Thanks, that's what I needed.

> Well, the help system actually imports the subpackages that live in the 
> mx space when you ask for help about them. So that's why doing that 
> allows you to resolve those names.

Makes sense.

> It's just a matter of using the packages in the intended way.

Thanks! I tried to look on the egenix website for usage info, but it
just had API info.

The odd thing is that Egenix has an EXAMPLES link on their page. If you
scroll down and look at the actual code examples, you'll see that it
starts out FROM blah IMPORT *. So, you can understand why I did it that
way. I prolly didn't do it deep enough (stopped at mx instead of
mx.blah).

> Well the first thing to try would be dropping it into /usr/lib/python2.2 
> and seeing if you can import it without errors. You might actually find 
> that the built-in "time" module contains enough date/time functionality 
> for your needs if they are simple.

My needs are pretty simple. Maybe you can point me in the right
direction. I need to compare the creation time of a file with a date,
and determine if I need to delete it. I know how to use stat to get the
file creation time. I can get the current time. If I subtract the file
ctime from the current time, how do i turn that delta into days?

Thanks for all your help!

Eric



More information about the Python-list mailing list