# File system paths in Meta.parse end up in error on Windows

**URL:** <https://discourse.julialang.org/t/file-system-paths-in-meta-parse-end-up-in-error-on-windows/14903>\
**Category:** General Usage\
**Created:** [September 13, 2018, 10:09am UTC](https://discourse.julialang.org/t/file-system-paths-in-meta-parse-end-up-in-error-on-windows/14903 "2018-09-13T10:09:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![essenciary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/essenciary/32/210469_2.png) [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Post date:** [September 13, 2018, 10:09am UTC](https://discourse.julialang.org/t/file-system-paths-in-meta-parse-end-up-in-error-on-windows/14903/1 "2018-09-13T10:09:59Z")

</div>

Is this to be expected? How should it be handled?

Windows 10:

```julia
julia> p = pwd()
"C:\\Users\\adrian\\testapp"

julia> Main, Meta.parse("""joinpath("$p", "src")""")
ERROR: Base.Meta.ParseError("invalid escape sequence")
Stacktrace:
 [1] #parse#1(::Bool, ::Bool, ::Bool, ::Function, ::String, ::Int64) at .\meta.jl:129
 [2] #parse at .\none:0 [inlined]
 [3] #parse#4(::Bool, ::Bool, ::Function, ::String) at .\meta.jl:164
 [4] parse(::String) at .\meta.jl:164
 [5] top-level scope at none:0

```

macOS:

```julia
julia> p = pwd()
"/Users/adrian"

julia> Meta.parse("""joinpath("$p", "src")""")
:(joinpath("/Users/adrian", "src"))

```

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [September 13, 2018, 10:16am UTC](https://discourse.julialang.org/t/file-system-paths-in-meta-parse-end-up-in-error-on-windows/14903/2 "2018-09-13T10:16:41Z")

</div>

That’s annoying indeed, but has an easy fix:

```nohighlight
Meta.parse("""joinpath($(repr(p)), "src")""")

```

repr is pretty handy for such tasks 😉

---

<div class="post-metadata">

**Author:** ![essenciary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/essenciary/32/210469_2.png) [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Post date:** [September 13, 2018, 10:21am UTC](https://discourse.julialang.org/t/file-system-paths-in-meta-parse-end-up-in-error-on-windows/14903/3 "2018-09-13T10:21:20Z")

</div>

Wow, that’s a cool function! I didn’t know about it. It does fix it, thanks!

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [September 13, 2018, 1:51pm UTC](https://discourse.julialang.org/t/file-system-paths-in-meta-parse-end-up-in-error-on-windows/14903/4 "2018-09-13T13:51:13Z")

</div>

Unless you are just playing with the parser, you shouldn’t use `Meta.parse` for this. Just interpolate the expression directly. There’s absolutely no way you can make this generic and safe.
