On 6/14/06, Tim Blechmann TimBlechmann@gmx.net wrote:
would this python one-liner be an option for you?
import random, glob
def choose(path): return random.choice(glob.glob(path+"/*.mov"))
I hard coded the path so it looks like this:
import random, glob
def randy(): return random.choice(glob.glob("E:/pd_merge/past/*.mov"))
The only problem is the output from the py object is
print: symbol E:/pd_merge/past\\5.4.2006.9.49.4.mov
What's up with the extra \\ ? Getting this working could solve a huge headache on Windows.
Thanks cgc
On Wed, 2006-06-14 at 13:48 -0500, chris clepper wrote:
print: symbol E:/pd_merge/past\\5.4.2006.9.49.4.mov
What's up with the extra \\ ? Getting this working could solve a huge headache on Windows.
i bet, that's the way of pd's gui to display the string ...past\5.4.... any that you can directly use this symbol to open the file ... btw, i guess that os.path.join("E:", "pd_merge", "past", "*.mov") would be the prefered way to concatenate path names ...
hth ... t
-- tim@klingt.org ICQ: 96771783 http://www.mokabar.tk
Cheat your landlord if you can and must, but do not try to shortchange the Muse. It cannot be done. You can't fake quality any more than you can fake a good meal. William S. Burroughs
On 6/14/06, Tim Blechmann TimBlechmann@gmx.net wrote:
On Wed, 2006-06-14 at 13:48 -0500, chris clepper wrote:
print: symbol E:/pd_merge/past\\5.4.2006.9.49.4.mov
What's up with the extra \\ ? Getting this working could solve a huge headache on Windows.
i bet, that's the way of pd's gui to display the string ...past\5.4.... any that you can directly use this symbol to open the file ...
It does work. Thanks.
btw, i guess that os.path.join("E:", "pd_merge", "past", "*.mov") would
be the prefered way to concatenate path names ...
I'll need to dig into the file handling capabilities of python now since I need to move and delete files as well.