Re: Pythonwin not loading DLL, should I change extensions by .pyo or pyd?
En Mon, 17 Nov 2008 13:01:11 -0200, Pekeika <[EMAIL PROTECTED]> escribió: Python 2.5 doesn't support/load .dll anymore. Is PythonWin 2.5 the same case? If a .DLL file is not loading, should I change its extension for it to work? What extensions should be now, .pyo, .pyd, etc? which one? What is the meaning of each extension? Python supports being extended using "extension modules"; on Windows they are dynamic libraries (DLL). Before 2.5, the extensions ".dll" and ".pyd" were both valid; starting with 2.5, only files ending in ".pyd" are recognized. Note that this applies to extension modules *only*, not generic DLLs. All binary packages targeted to 2.5 use the right name for their extension modules, at least all that I know of. You don't have to rename anything. A .pyo file is a totally different thing; it's a compiled Python source (like a .pyc) but with optimization turned on. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Pythonwin not loading DLL, should I change extensions by .pyo or pyd?
Python 2.5 doesn't support/load .dll anymore. Is PythonWin 2.5 the same case? If a .DLL file is not loading, should I change its extension for it to work? What extensions should be now, .pyo, .pyd, etc? which one? What is the meaning of each extension? Thanks, Angelica E-G. -- http://mail.python.org/mailman/listinfo/python-list
Re: change extensions
Tim Roberts wrote: "Bob Then" <[EMAIL PROTECTED]> wrote: how can i change all files from one extension to another within a direcory? In Windows, the quickest way is: os.system( "rename *.old *.new" ) I have a vague memory that this won't work on all versions of Windows... possibly it isn't supported on Win98? That may not be quite right, but I recall problems doing this in the past. (Or was it just DOS that failed?) -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: change extensions
"Bob Then" <[EMAIL PROTECTED]> wrote: >how can i change all files from one extension to another within a direcory? In Windows, the quickest way is: os.system( "rename *.old *.new" ) -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: change extensions
On Apr 5, 2005 10:43 AM, Jeffrey Maitland <[EMAIL PROTECTED]> wrote: > That approach works, but so does this one. > > import os, glob > > input_file_list = glob.glob('*.txt') > for in_file in input_file_list: > name = in_file.split('.') > os.rename(in_file, str(name[0]) + '.' + 'text')) > you should really use in_file.splitext - your script renames myfile.with.lots.of.dots.txt to myfile.text instead of myfile.with.lots.of.dots.text . If you *really* wanted to use split(), it oughta be ''.join(in_file.split('.')[:-1]) , but why not use the built-in? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list
RE: change extensions
That approach works, but so does this one. import os, glob input_file_list = glob.glob('*.txt') for in_file in input_file_list: name = in_file.split('.') os.rename(in_file, str(name[0]) + '.' + 'text')) # I could have put the text extension with the period but if you use a variable (string) for the extension then you can't -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Hansen Sent: Tuesday, April 05, 2005 10:35 AM To: python-list@python.org Subject: Re: change extensions Bob Then wrote: > how can i change all files from one extension to another within a direcory? Using Jason Orendorff's path.py module: # change all .py files in '.' to extension .new from path import path for f in path('.').files(): if f.endswith('.py'): f.rename(f.splitext()[0] + '.new') Don't try the above in a folder containing useful Python files! ;-) -Peter -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: change extensions
Bob Then wrote: how can i change all files from one extension to another within a direcory? Using Jason Orendorff's path.py module: # change all .py files in '.' to extension .new from path import path for f in path('.').files(): if f.endswith('.py'): f.rename(f.splitext()[0] + '.new') Don't try the above in a folder containing useful Python files! ;-) -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: change extensions
Bob Then wrote: > how can i change all files from one extension to another within a direcory? This should work: import os def change_exts(suffix, new_suffix, dir_name): for name in os.listdir(dir_name): if name.endswith(suffix): old_pathname = os.path.join(dir_name, name) new_pathname = old_pathname[:-len(suffix)] + new_suffix os.rename(old_pathname, new_pathname) David. -- http://mail.python.org/mailman/listinfo/python-list
Re: change extensions
Bob Then wrote: how can i change all files from one extension to another within a direcory? Using os.listdir, os.path.split and os.rename. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
change extensions
how can i change all files from one extension to another within a direcory? -- http://mail.python.org/mailman/listinfo/python-list