4
$\begingroup$

Exporting Image files (intermittently) doesn't work:

enter image description here

I get messages back indicating the error is to do with escaping characters:

Syntax::stresc: Unknown string escape \\U.
$\endgroup$

2 Answers 2

4
$\begingroup$

I am answering my own question to help out other .Net/Mathematica developers in the future.


I am using random file names (DTWERG, ERYFGJ, IYIGGD) and it turns out when Mathematica exports an image file that has a slash and followed by : b, t, n, f, r it recognises/honors the escape slash.

For example when a file name starts with an r as per the screenshots, it treats the \r as a newline, a CRLF!

Using forward slashes rather than backslashes resolved the problem:

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ This applies to Windows-based filenames in standard Mathematica functions like SetDirectory. Hit that one today myself. $\endgroup$
    – Verbeia
    Commented Apr 4, 2013 at 8:14
  • $\begingroup$ To be precise, \r is CR. LF is \n. Another way to deal with it is to escape the backslashes. $\endgroup$ Commented Jul 14, 2013 at 13:11
1
$\begingroup$

Put double slashes instead of single slashes:

Not:

C:\Users\Blabla

Rather:

C:\\Users\\Blabla

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.