July 13th, 2013, 12:26 PM
Strings and that silly backslash... (also, timeit)
So, this is back on the original auto-timeit function I was discussing earlier.
The problem is, as best I can discern, found while the interpreter is sending code to the shell, it's parsing the link down to the point where it's only sending a single backslash and not a double backslash as is required for python to parse it into a proper file directory.
Traceback (most recent call last):
File "C:\Documents and Settings\*****\Desktop\Console\benchmarking.py", line 26, in <module>
File "C:\Documents and Settings\*****\Desktop\Console\benchmarking.py", line 16, in benchmark
File "C:\Python27\lib\timeit.py", line 230, in timeit
return Timer(stmt, setup, timer).timeit(number)
File "C:\Python27\lib\timeit.py", line 136, in __init__
code = compile(src, dummy_src_name, "exec")
File "<timeit-src>", line 4
pull= storage_functions(extension=".tmp",location="C:\Documents and Settings\*****\Desktop\Console\Temp\")
SyntaxError: EOL while scanning string literal
So, I guess the question is, 'How to I sanitize my string input in such a way that I can send it double backslashes?'
or, if that's not the case:
What's the EOL error I'm getting here?
any help would be appreciated.
Also, the name of that folder is not a series of asterisks, I'm just using my own computer and I don't want everyone on the internet to know the name of my grandmother. :P
July 13th, 2013, 12:59 PM
Python allows forward slashes to avoid this problem
pull= storage_functions(extension=".tmp",location="C:/Documents and Settings/****/Desktop/Console/Temp/")
Last edited by dwblas; July 13th, 2013 at 01:24 PM.
July 13th, 2013, 01:17 PM
July 13th, 2013, 01:33 PM
Does the timeit lack read permissions? I can't get it to open the dang file. :\