# System.file File Path Only Works When User Selects File

**URL:** <https://forum.inductiveautomation.com/t/system-file-file-path-only-works-when-user-selects-file/111330>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [October 9, 2025, 9:36pm UTC](https://forum.inductiveautomation.com/t/system-file-file-path-only-works-when-user-selects-file/111330 "2025-10-09T21:36:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [October 9, 2025, 9:36pm UTC](https://forum.inductiveautomation.com/t/system-file-file-path-only-works-when-user-selects-file/111330/1 "2025-10-09T21:36:44Z")

</div>

I have a file in a known destination. I pre-define the path in a string and use `system.file.readFileAsString()` with the string path it says the file doesn’t exist.

If I use `system.file.openFile()`, and print the file path that it got to compare it omits one of the “\”

Why?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/4/04d835c3920a9b368c0beab22877eda7842e1a75.png)

Does the “\” require an escape character?

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [October 9, 2025, 9:41pm UTC](https://forum.inductiveautomation.com/t/system-file-file-path-only-works-when-user-selects-file/111330/2 "2025-10-09T21:41:13Z")

</div>

yes. or try a r”yourpath”

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [October 9, 2025, 9:41pm UTC](https://forum.inductiveautomation.com/t/system-file-file-path-only-works-when-user-selects-file/111330/3 "2025-10-09T21:41:49Z")

</div>

r”path” worked

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 9, 2025, 9:42pm UTC](https://forum.inductiveautomation.com/t/system-file-file-path-only-works-when-user-selects-file/111330/4 "2025-10-09T21:42:53Z")

</div>

'r' is the "raw string modifier".

[2. Lexical analysis — Python 2.7.18 documentation](https://docs.python.org/2/reference/lexical_analysis.html#string-literals) says,

> Unless an `'r'` or `'R'` prefix is present, escape sequences in strings are interpreted according to rules similar to those used by Standard C.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 9, 2025, 10:20pm UTC](https://forum.inductiveautomation.com/t/system-file-file-path-only-works-when-user-selects-file/111330/5 "2025-10-09T22:20:53Z")

</div>

Even better fix is to just not use backslashes in your literal paths. Every Ignition API and Java API (and even most standard Jython lib APIs) will happily accept forward slashes, even on Windows.
