[Tutor] cannot find html file, in the same dir as python file

monikajg at netzero.net monikajg at netzero.net
Mon Sep 5 22:18:30 EDT 2016


I put 

print( os.getcwd() )

into my script, and got 

C:\Users\Monika\Documents\PythonWeb\class3code\class3code

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



--------- Original Message ----------
From: Alan Gauld via Tutor <tutor at python.org>
To: tutor at python.org
Subject: Re: [Tutor] cannot find html file, in the same dir as python file
Date: Tue, 6 Sep 2016 01:25:27 +0100

On 05/09/16 21:59, monikajg at netzero.net wrote:

>         chromedriver = "resources/chromedriver"
>         os.environ["webdriver.chrome.driver"] = chromedriver
>         self.driver = webdriver.Chrome(chromedriver)
>         base_url = 'button.html'
>         self.driver.get(base_url)
> 
> FileNotFoundError: [WinError 2] The system cannot find the file specified
> Even though this is in Selenium this is a python question. I think.

Have you tried giving it the full path?

Have you tried asking Python where it is looking, eg

print( os.getcwd() )

Just in case Python is not running where you think
it is - I can't remember how windows decides... and
its better not to guess anyway.

-- 
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


_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

____________________________________________________________
howlifeworks.com (Sponsored by Content.Ad)
How to Read Your Child's Deleted Texts - Get Your Free Trial
http://thirdpartyoffers.netzero.net/TGL3241/57ce27cfe928e27cf1ef7st04duc


More information about the Tutor mailing list