On Thu, Mar 5, 2015 at 7:20 PM, Amit Kucheria amit.kucheria@linaro.org wrote:
On Thu, Mar 5, 2015 at 3:49 PM, Vincent Guittot vincent.guittot@linaro.org wrote:
On 19 November 2014 at 14:14, pi-cheng.chen pi-cheng.chen@linaro.org wrote:
+if __name__ == '__main__':
- tmp = 'tmp.json'
your tmp file should be a bit more unique than tmp.json. I can imagine that the user of tune_json.py already has a tmp.json in the dir which will be overwritten by the script. You could add something like the current time stamp in the temporary file name to reduce the probability to overwrite a user's file
Or actually use the python standard library functions to generate unique temporary files: https://docs.python.org/2/library/tempfile.html
If you care about referencing the file externally, NamedTemporaryFile might be the right method to use.
Hi Vincent & Amit,
Thanks for reviewing. I will fix the temporary file naming.
Best Regards, Pi-Cheng