2
$\begingroup$

I am a bit confused with a notebook I am using to test a package that contains some useful functions.

Both the notebook and the package are in the early stages of development; I move them around a bit, so I load the package for testing purposes, using Needs[context,path]

enter image description here

As you might see in the screenshot snippet above, the cell that contains Needs turns orange after evaluation and hovering the cursor over the box on its top corner, produces a tool-tip reading "Show Messages/Retry";

After clicking on the box, the cell reverts to it's normal state; there are no new messages displayed (Window > Messages brings up an empty Messages terminal).

The confusing part is that-as far as I can tell-all tests I perform after loading the package, get evaluated without problems and all return successful.

My question is, am I somehow abusing Needs? Is the displayed behavior a sign of a malformed package? Where should I look for further details on how to tackle this issue?

$\endgroup$
  • 1
    $\begingroup$ Please include code in your question besides the image. And just as a remark on the side: your path can more easily be defined using ParentDirectory[NotebookDirectory[]]. $\endgroup$ – Sjoerd Smit Feb 7 '18 at 16:58
  • $\begingroup$ Also, can you try to make the example shorter? What if you manually enter the path? Is the With necessary to trigger the problem? $\endgroup$ – Szabolcs Feb 7 '18 at 17:06
  • $\begingroup$ "Is the displayed behavior a sign of a malformed package?" If it happens even with a simple Needs["myContext`", "/this/is/my/path"], then maybe yes (but I do not recall seeing such behaviour before). $\endgroup$ – Szabolcs Feb 7 '18 at 17:08
  • $\begingroup$ @SjoerdSmit thanks for the tip; I'll use it if I keep my current file layout; please clarify what do you mean by "[...] include code"; I think posting the contents of the package is not productive; I don't expect anyone to debug my code; I used an image on purpose because I don't see how I can reproduce the problem with the orange cell on a code block; $\endgroup$ – user42582 Feb 7 '18 at 17:35
  • 1
    $\begingroup$ It seems probable that there is a problem with the package. Try to trim it down to a minimal example—that should reveal the problem. If you can't, upload the package file somewhere. Preferably just upload the file as it is instead of posting the contents here. It could even be some stray bad unicode character that would disappear if inlined into your post. $\endgroup$ – Szabolcs Feb 7 '18 at 17:41
7
$\begingroup$

The problem was caused from an erroneous usage string namely the usage string contained unescaped backslashes.

Instead of writing

aFunction::usage="aFunction[path] returns output at 'path\output\dump.txt'"

the usage string should have read

aFunction::usage="aFunction[path] returns output at 'path\\output\\dump.txt'"
$\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.