The r trick did it. Yay! Thank you Monika ---------- Original Message ---------- From: Alan Gauld <alan.ga...@yahoo.co.uk> To: "monik...@netzero.net" <monik...@netzero.net> Cc: tutor@python.org Subject: Re: [Tutor] cannot find html file, in the same dir as python file Date: Tue, 6 Sep 2016 08:43:03 +0100
On 06/09/16 03:18, monik...@netzero.net wrote: > I put > > print( os.getcwd() ) > > into my script, and got > > C:\Users\Monika\Documents\PythonWeb\class3code\class3code Is that the directory you expected? Is it where your html file lives? > So I put into my script: > > base_url = > 'C:\Users\Monika\Documents\PythonWeb\class3code\class3code\button.html' > instead of base_url = 'button.html' > and ran it andI got a popup message in python: > > (unicode error) 'unicodesscape' codec can't decode bytes in position 2-3; > truncated \UXXXXXXXXescape Because you are using a single backslash Python sees the \U as a Unicode indicator. Either change the backslashes to forward slashes or put an 'r' in front of the string to make it raw: base_url = r'C:\Users\Monika\Documents\.....' -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ____________________________________________________________ moneynews.com (Sponsored by Content.Ad) 5 Stocks to Buy Now | Massive Market Correction http://thirdpartyoffers.netzero.net/TGL3241/57cee48f50a49648f16dfst01duc _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor