Re: Formatting device from a script on Windows
this may help, you need ctypes module.
##
from ctypes import *
fm = windll.LoadLibrary('fmifs.dll')
def myFmtCallback(command, modifier, arg):
print command
return 1# TRUE
FMT_CB_FUNC = WINFUNCTYPE(c_int, c_int, c_int, c_void_p)
FMIFS_HARDDISK = 0x0C
fm.FormatEx(c_wchar_p('H:\\'), FMIFS_HARDDISK, c_wchar_p('NTFS'),
c_wchar_p('title'), True, c_int(0), FMT_CB_FUNC(myFmtCallback))
--
http://mail.python.org/mailman/listinfo/python-list
Re: Does any one know of any good folder/directory modules
"[EMAIL PROTECTED] 写道: " > Hi > > Does any one know of any good folder/directory modules. I need to be > able to see what files and directories are in a folder, I also need to > be able to see the size of the directory content. > > Thanks This one is more convenient: http://www.jorendorff.com/articles/python/path -- http://mail.python.org/mailman/listinfo/python-list
Re: Building python C++ extension modules using MS VC++ 2005?
Sure you can build extensions for Python2.4 with VS2005, I've always done this way. And with Pyrex it is very very easy. Make sure to have a look at Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex -- http://mail.python.org/mailman/listinfo/python-list
Re: bicycle repair man help
On 6/24/07, Rustom Mody <[EMAIL PROTECTED]> wrote:
> Does someone know that when using bicycle repair man to refactor python code
> what exactly extract local variable means?
It means extracting a part (or all of) an expression and replacing it
with a sensibly-named local variable.
Shamelessly copied from c2:
> For example:
>
> if ( (x==0) || ((y<17) && name == null) ) {
>..
> }
>
> becomes:
>
> final boolean outOfActiveAreal = (x==0) || ((y<17) && name == null) ;
> if (outOfActiveAreal ) {
>..
> }
Some more articles:
http://refactoring.com/catalog/introduceExplainingVariable.html and
http://c2.com/cgi-bin/wiki?IntroduceExplainingVariable have
discussions of them.
-rob
--
http://mail.python.org/mailman/listinfo/python-list
Re: formatting number of bytes to human readable format
On 13 Aug 2008, rkmr wrote: > is there any library / function that prints number of bytes in human > readable format? > for example > > a=XX(1048576) > print a > > should output > 1 MB http://mail.python.org/pipermail/python-list/1999-December/018519.html is a good start - just need to change the table to something like:: _abbrevs = [ (2 ** 30L - 1, 'G'), (2 ** 20L - 1, 'M'), (2 ** 10L - 1, 'K'), (1, '') ] (and add a 'B'). -- -rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Downloading and Installing gasp
On 13 Aug 2008, Cyprian Kumwaka wrote: > I am a beginner in Python. Please tell me how to go about in > downloading and installing the module gasp.I am using Python 2.5.2. What OS are you using? Do you have PyGame installed already? -- -rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Checking a file's time stamp -- followup
On 13 Aug 2008, Virgil Stokes wrote: > Is it possible to change the time stamp of a file (Win2K platform)? If > yes, how? os.utime, http://docs.python.org/lib/os-file-dir.html. -- -rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Timer or Scheduler in a Class
On 14 Aug 2008, William Battersea wrote:
> Both run once and end. I'm obviously missing something here.
That's how both ('sched' and threading.Timer) of the them work.
Depending on what you're doing, your toolkit/framework (Twisted, GTK,
etc) might have a better solution. Or
http://www.gossamer-threads.com/lists/python/python/652793?page=last.
--
-rob
--
http://mail.python.org/mailman/listinfo/python-list
Re: print "%s"
On 18 Aug 2008, Beema Shafreen wrote:
> Hi ALL,
>
> In my script i have to print a series of string , so
>
> print "%s\t%s\t%s\t%s\t%s\t%s\t" %("a","v","t","R","s","f")
print "\t".join(("a","v","t","R","s","f")) + "\t"
Note the double brackets.
--
-rob
--
http://mail.python.org/mailman/listinfo/python-list
Re: Python Substitute for PHP GD, Resizing an image on the client side
On 19 Aug 2008, [EMAIL PROTECTED] wrote: > Hi Folks, > > I am using cherrypy and python. I am trying to get a user profile > image to resize on the client side before uploading to the server. PHP > has a gd library that does it it seems. PIL? http://www.pythonware.com/products/pil/. -- -rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie Question:Please help
On 9 Sep 2008, Karthik Krishnan wrote: > File "", line 1 > python main_test.py > > Syntax Error: invalid syntax I get: File "/tmp/x.py", line 11 if __name__ = "__main__": ^ SyntaxError: invalid syntax > if __name__ = "__main__": ^ = is used for assignment in Python, you want ==. -- -rob -- http://mail.python.org/mailman/listinfo/python-list
