How to run a executable file on Jupyter Notebook?

4,768 views
Skip to first unread message

Kevin Le

unread,
Nov 9, 2016, 4:03:49 PM11/9/16
to Project Jupyter
I am still new to using Jupyter Notebook on an Ubuntu Gnome distribution and I wanted to know how to run an python executable created from pyinstaller.

Here are some of the commands I've tried to use on Jupyter Notebook, but I always get an syntaxerror when I try to run them. However, these
commands work on a terminal and these files do have permission to be executed.

ls
log_X.txt  log_Y.txt  play_X*  play_Y*  Untitled1.ipynb  Untitled.ipynb

 
/home/kevin/Desktop/executables/play_X
  File "<ipython-input-2-ac9c760b354d>", line 1
    home(/kevin/Desktop/executables/play_X)
         ^
SyntaxError: invalid syntax


./play_X
  File "<ipython-input-1-cf87a64c1b20>", line 1
    ./play_X
    ^
SyntaxError: invalid syntax


Thomas Kluyver

unread,
Nov 9, 2016, 5:56:28 PM11/9/16
to Project Jupyter
The commands to run the executable are shell commands, not IPython commands. You can run a shell command in IPython by starting a line with !

However, if you want to run things from a notebook, you shouldn't need to make an executable with Pyinstaller. You can run a Python script file with:

%run foo.py

Or you can import it and call functions it defines:

import foo
foo.bar()

Thomas

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/c03ec9c4-7c15-4053-9ca1-6f47e6bd3e27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages