0

In the same way we can execute regular Python using shebangs (or PyLauncher on windows), can we do the same with Ipython and .ipy files?

Registering IPython in Windows registry so double-click .ipy launches IPython Console. Or from linux just adding an 'i' to '/usr/bin/python' and execute.

In Windows this would be really helpful, because one of the trickest parts of "system integration" is the command line arguments. If these could be tucked into a text file on the shebang (pylauncher style), that would be fabulous.

1
  • I know its a bit dirty, but the idea is to process some datasets that utilize macros defined from other sessions. Would really speed up development and would be a workaround for PATHing and libraries (which really don't belong in the test scripts). Commented Apr 8, 2013 at 23:44

1 Answer 1

1

Not sure if I fully understand your problem, but you can create a py.ini file on Windows as described in the Customized Commands section of PEP 397 of which PyLauncher is an implementation.

[commands]
ipython=C:\Anaconda\Scripts\ipython.exe -v

Changing the path to where your local IPython is installed. If you associate the .ipy file extension with the pylauncher executable ( typically C:\Windows\py.exe and you can save the py.ini file to the same path ) and use the shebang below at the top of your .py/.ipy files they should run with ipython and the options specified in the py.ini file

#! ipython

You can also associate the ipython.exe with .ipy files on Windows and it will run the .ipy files.

Sign up to request clarification or add additional context in comments.

1 Comment

I thought as much, but this was a definite confirmation (in regards to the pylauncher 'py.ini'). Much cleaner than trying to setup symbolic links.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.