Hello all,
I Need to figure out how to call testfile.NamedTemporaryFile() so I can use a specific file name instead of the randomly generated one.
I have 0 experience in python and I was attempting to modify the source of a python app (gmailfs.py: see section 4.2 on:
showthread.php?t=447218 for more info) to get it to do what I want. I do have experience in C/C++ so I was able to figure out what was going on (sort of) be reading the code. It looks like the code creates a randomly named file to contain some saved data. I need to create the new file with the same name as the old one.
I found that NamedTemporaryFile() is a function in tempfile.py so I tried having gmailfs.py call the function as so:
Code:
tmpf = tempfile.NamedTemporaryFile('w+b',-1,"",name,None)
where name is the name of the old file, and all other parameters are the defaults listed in testfile.py. It will create the file with 'name' as the prefix and the random garbage tacked onto the end. Passing a suffix parameter just added the suffix to the end of the random garbage.
Is there an easy way to call this function with a specifically named file with no randomness in the name?
Thanks everybody for your time!
...drkstr
**edit**
I realize I also mention this question in the thread listed above, however I thought it better to have it's own thread.
sorry to double post!
...drkstr
**edit**