# FAIL 	FileNotFoundError: \[Errno 2\] No such file or directory

**URL:** <https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451>\
**Category:** Robot Framework\
**Created:** [23 September 2021 13:23 UTC](https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451 "2021-09-23T13:23:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morad\_Elkhaily](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Morad\_Elkhaily](https://forum.robotframework.org/u/Morad_Elkhaily)\
**Post date:** [23 September 2021 13:23 UTC](https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451/1 "2021-09-23T13:23:42Z")

</div>

Hello guys,

I face an issue about the RBFW Keyword “Get File”.  
When I launch it on Jenkins, the error below was shown in the log.

## ${Data} = OperatingSystem . Get File ${File\_Name}, encoding=UTF-8, encoding\_errors=strict INFO Getting file ‘[/opt/robotframework/temp/src/resources/Numero\_Ticket.txt] (file:///opt/robotframework/temp/src/resources/Numero\_Ticket.txt)’. **FAIL FileNotFoundError: [Errno 2] No such file or directory: \*\* \*\* ‘/opt/robotframework/temp/src/resources/Numero\_Ticket.txt’**

**the Keyword**

UI - Lire Contenu Fichier  
${Data} Get File ${File\_Name} encoding=UTF-8 encoding\_errors=strict

NB: ${File\_Name} = src//resources//Numero\_Ticket.txt

Help plz.

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [23 September 2021 13:37 UTC](https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451/2 "2021-09-23T13:37:55Z")

</div>

> [@Morad\_Elkhaily](#):
>
> /opt/robotframework/temp/src/resources/Numero\_Ticket.txt

That was the file it searched for, not the one you intended (src/resources/Numero\_Ticket.txt).  
Because you assumed relative path starting from ${CURDIR}/src/…  
But Jenkins job started at its workspace, /opt/robotframework/temp/

The solution is for you to provide FULL path to the file (and making sure it exists on the Jenkins node running the job.

---

<div class="post-metadata">

**Author:** ![Morad\_Elkhaily](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Morad\_Elkhaily](https://forum.robotframework.org/u/Morad_Elkhaily)\
**Post date:** [23 September 2021 13:48 UTC](https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451/3 "2021-09-23T13:48:47Z")

</div>

Thank you for your answer, I have already entered the full path in which I have the file **“C://Workspace-score//src//resources//Numero\_Ticket.txt”** and it displays the same error again.

How can i provide FULL path to the file plz.

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [23 September 2021 13:59 UTC](https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451/4 "2021-09-23T13:59:10Z")

</div>

Well, when you use / you do not need //. Only when using \ you need \\.

You should use a FULL path when you know the exact location in the Jenkins node (probably not your machine), or use a relative path for example based on the location of the test suite file. There are some default variables for this. for example the ${CURDIR} (and maybe ${TESTDIR}, you need to check).

Maybe ${CURDIR}/src/resources/Numero\_Ticket.txt works, but you are the only one who can try.

You can also map Jenkins node environment variables, like ${WORKSPACE}.

---

<div class="post-metadata">

**Author:** ![Morad\_Elkhaily](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Morad\_Elkhaily](https://forum.robotframework.org/u/Morad_Elkhaily)\
**Post date:** [23 September 2021 16:59 UTC](https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451/5 "2021-09-23T16:59:50Z")

</div>

Issue resolved thank you so mush 👍

---

<div class="post-metadata">

**Author:** ![paulocress](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@paulocress](https://forum.robotframework.org/u/paulocress)\
**Post date:** [9 November 2021 11:01 UTC](https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451/6 "2021-11-09T11:01:42Z")

</div>

> [@Morad\_Elkhaily](#):
>
> FileNotFoundError: [Errno 2] No such file or directory

When you open a file with the name “filename.ext”; you are telling the open() function that your file is in the current working directory . This is called a relative path.

`file = open('filename.ext') //relative path`

In the above code, you are not giving the full path to a file to the open() function, just its name - a relative path. The error “[FileNotFoundError](http://net-informations.com/python/err/path.htm): [Errno 2] No such file or directory” is telling you that there is no file of that name in the working directory. So, try using the exact, or absolute path.

`file = open(r'C:\path\to\your\filename.ext') //absolute path`

In the above code, all of the information needed to locate the file is contained in the path string - absolute path.

---

<div class="post-metadata">

**Author:** ![Patthiya193](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/patthiya193/32/1477_2.png) [@Patthiya193](https://forum.robotframework.org/u/Patthiya193)\
**Post date:** [3 May 2022 21:37 UTC](https://forum.robotframework.org/t/fail-filenotfounderror-errno-2-no-such-file-or-directory/2451/7 "2022-05-03T21:37:59Z")

</div>

After 1 year this still workk! tysm 🙏 🙏 🙏 🙏
