8
$\begingroup$

Bug introduced in 10.4 or earlier and fixed in 11.2


I've found that NotebookImport[file,"Input" -> "HeldInterpretedCell"] doesn't seem to cope when the closing bracket of a command is on the following line of an input cell.

So if I save a notebook test.nb with the following input cell (as one cell):

Plot[x, {x, 0, 1}
 ]

Then NotebookImport["test.nb","Input" -> "HeldInterpretedCell"] gives a Failure[] box instead of the expected HoldComplete[Plot[x,{x,0,1}]].

With multiple different cells with different permutations:

Plot[x, {x, 0, 1}
 ]

Plot[x, {x, 0, 1}]

Plot[x,
 {x, 0, 1}]

Plot[
 x,
 {x, 0, 1}]

the first and last will fail, but the middle two are fine. It looks like it is related to the square brackets of the outmost command being the end/start of a line.

Is this a bug?

$\endgroup$
  • $\begingroup$ I'd say so, meanwhile you can probably use ideas from: Reading Cells or Boxes expression by expression $\endgroup$ – Kuba May 19 '17 at 12:47
  • $\begingroup$ I asked the question based on the answers in mathematica.stackexchange.com/questions/146167 sometimes giving errors, and traced it back to this. I can probably hack the part out of the Failure[] box that I need. $\endgroup$ – KraZug May 19 '17 at 13:30
  • 2
    $\begingroup$ Not only "HeldInterpretedCell" but also "InterpretedCell" fails miserably. I think it is a bug, definitely worth reporting. $\endgroup$ – Alexey Popkov May 19 '17 at 14:30
  • 1
    $\begingroup$ With versions 11.0.1 and 10.4.1 I get the same failure for "HeldInterpretedCell" and "InterpretedCell" as with version 11.1.1. $\endgroup$ – Alexey Popkov May 19 '17 at 14:34
  • $\begingroup$ Bug submitted to Wolfram. $\endgroup$ – KraZug May 22 '17 at 9:13
1
$\begingroup$

Wolfram Support emailed me to let me know that this has been fixed in v11.2, which I've confirmed.

$\endgroup$

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.