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$
  • $\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$ – user6014 Aug 2 '17 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 Aug 2 '17 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$ – user6014 Aug 2 '17 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 Aug 2 '17 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$ – user6014 Aug 2 '17 at 15:20
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.

|improve this answer|||||
$\endgroup$
  • $\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 Aug 3 '17 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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