Jump to content
FranzB

Jupyter Notebook with P4D

Recommended Posts

can I start Jupyter Notebooks using P4D components ? 

P4D is installed,  can this be done with Delphi code  or / and python code 

 

 

what I need 

 

a) check if notebook is available on  my computer   

 

c) start a  new notebook 

 

 

 

regarding a)

pip install notebook

regarding b)

jupyter notebook

 

 

Share this post


Link to post

As far as I understand your question, your problem lies in the plane of using the command line

 

You can do this in many ways: for example, by running a command line script directly from Object Pascal

although it is possible, in order to interact with the Jupyter Notebook API later on it will be more convenient for you to use a python script via Py4D components to interact with the command line

 

a-la:

  var cmdlines := TStringList.Create();
  cmdlines.Add('import subprocess');
  cmdlines.Add('result = subprocess.run(["jupyter", "notebook", "list"], stdout=subprocess.PIPE)');
  cmdlines.Add('print(result.stdout)');
  PythonEngine.ExecString(cmdlines.Text);

(this sample shows usage of usage of subprocess module for command line call - prints the list of running Jupyter Notebooks e.g. ''jupyter notebook list" output)

 

Hope this can be helpful

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×