[Tutor] Installing the uncertainties module

Richard D. Moores rdmoores at gmail.com
Sun Oct 30 06:33:49 CET 2011


On Sat, Oct 29, 2011 at 22:06, Lie Ryan <lie.1296 at gmail.com> wrote:
> On 10/30/2011 03:55 PM, Richard D. Moores wrote:

>>
>> Hm. Problem:
>>
>>>>> import tarfile
>>>>> tar = tarfile.open("C:\Users\Richard\Desktop\uncertainties-1.8.tar.gz")
>>
>>   File "<stdin>", line 1
>> SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes
>> in position 2-4: truncated \UXXXXXXXX escape
>>
>
> use forward slash for file names even in Windows, or you had to escape the
> backslashes 'C:\\Users\\Richard\\Desktop\\uncertainties-1.8.tar.gz' or use
> raw string r"C:\Users\Richard\Desktop\uncertainties-1.8.tar.gz"

Should have thought of that.

>>> tar = tarfile.open("C:/Users/Richard/Desktop/uncertainties-1.8.tar.gz")
>>> tar.extractall()
>>> tar.close()
>>>

Thanks!

Dick


More information about the Tutor mailing list