[Haskell-beginners] system and FilePath with space

PICCA Frederic-Emmanuel frederic-emmanuel.picca at synchrotron-soleil.fr
Thu Jan 26 09:50:47 UTC 2017


Hello

I try to execute a command using system.

my code is like this


system (unwords ["python",  p])

where
p :: FilePath
p = "/my super/script.py"


has you can see this path contain a space.
When I try to run it I get an error

python: can't open file '/my':

So the system command is wrong.
I understand that I need to escape the space  in the command, like this

p = "/my\ super/script.py"

now is there a function in haskell for this.
a sort of sanitizer for FilePath when used by system.

Thanks

Frederic


More information about the Beginners mailing list