0
$\begingroup$

I'm having difficulties exporting some image files. I send the usual

Export["C:\\Users\\user\\Desktop\\filename.png", dataPlot];

But instead of exporting to the path, it sees it as a relative path:

Export::nodir: Directory C:\Users\user\Documents\C:\Users\user\Desktop\ does not exist. >>
Export::noopen: Cannot open C:\Users\user\Desktop\filename.png. >>

It has always worked fine, and it actually doesn't give any problems if I try Export in every other notebook. What can be the cause of it?

EDIT

Copying and pasting the code into a new notebook doesn't help, so the problem must be in the code.

Here is the code and here is an example input file

$\endgroup$
7
  • $\begingroup$ What version of M? I export a lot of things on Windows and have never seen this. Does a clean start (support.wolfram.com/kb/12464) help at all? $\endgroup$
    – ktm
    Commented Aug 2, 2017 at 15:10
  • $\begingroup$ It's Mathematica 10.4 on Windows 8. I've never seen that as well. I'll try with a clean start, but I wonder why it happens only on one specific notebook, where this is the only Exporting file operation and along with the initial data importing (the same as in the other notebooks) the only file I/O operation $\endgroup$
    – Enzo
    Commented Aug 2, 2017 at 15:13
  • $\begingroup$ It really is strange though. There may be an issue with that specific notebook? Would take examining it as a whole to identify though. Can you just trash it any move its content to a new one? Perhaps something is messed up in its meta information. $\endgroup$
    – ktm
    Commented Aug 2, 2017 at 15:14
  • $\begingroup$ I can't try a clean start as I don't have administrative privileges on this machine. If I copy and paste the notebook content onto a new one, the same error happens, so I assume the code is the issue? Would posting the whole code (I'll have to edit some confidential stuff) be useful? $\endgroup$
    – Enzo
    Commented Aug 2, 2017 at 15:18
  • $\begingroup$ Get rid of the confidential information, open the notebook up in Notepad, and paste the plaintext version to pastebin.com and I can take a look. If that works for you. $\endgroup$
    – ktm
    Commented Aug 2, 2017 at 15:20

1 Answer 1

2
$\begingroup$

It seems as though your file path in the Export call has a \[NoBreak] symbol in it. This seems to be an invisible symbol that you can only see when looking at the raw form of the code:

Cell["\<\
a = plot[1]; 
Export[\"\[NoBreak]C:\\\\Users\\\\user\\\\Desktop\\\\pulses2.png\", a]\
\>", "Input",
 CellChangeTimes->{}]    

No clue how that got there, although my guess would be that you copy and pasted the file path from somewhere else and somehow it got inserted along the way.

If you retype the same export call, i.e.

a = plot[1];
Export["C:\\Users\\user\\Desktop\\pulses2.png", a]

then it should work without issue.

$\endgroup$
1
  • $\begingroup$ That's it! I really wonder how that \[NoBreak] got there, since I always copy-paste the folder from Windows Explorer and it's always worked. Well, at least I know where it comes from now. Thank you! $\endgroup$
    – Enzo
    Commented Aug 3, 2017 at 8:51

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.