Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following creates a button to select a notebook to run. When the button is pressed it seems that Mathematica finds the notebook but cannot evaluate it. The following error occurs

Could not process unknown packet "1"

Button["run file 1", 

This occurs under Mathematica 8 on all platforms.

Any help greatly appreciated, Christina

share|improve this question
Does using Button[..., Method->"Queued"] help? – celtschk May 22 '12 at 17:08
Please evaluate this (and press the button) and report the result: Button["run file 1", TracePrint @ NotebookEvaluate[ "/../file1.nb"]] – Mr.Wizard May 22 '12 at 17:10
Also, please try a fully qualified path name, e.g. "C:/User/Notebooks/file1.nb" or whatever. – Mr.Wizard May 22 '12 at 17:11
Button[..., Method->"Queued"] worked. Many thanks celtschk and @Mr.Wizard – Christina May 22 '12 at 17:26
@celtschk please post that as an answer, or I shall. Christina, glad you've got it working! – Mr.Wizard May 22 '12 at 17:32
up vote 7 down vote accepted

To make it work, use

Button["run file 1", NotebookEvaluate["/../file1.nb"], Method->"Queued"]
share|improve this answer

In the comments celtschk suggested Button[..., Method -> "Queued"] and Christina confirmed it as a solution.

share|improve this answer
@Christina does Button["run 1", NotebookEvaluate["/../file1.nb"]] also work by itself? – Mr.Wizard May 22 '12 at 16:50
Great question @Mr.Wizard. It doesn't, I get the same error, so my question should actually be "How do I make NotebookEvaluate work inside Button?" I can't believe I didn't test that. – Christina May 22 '12 at 16:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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