Hacker News new | ask | show | jobs
by UnquietTinkerer 2931 days ago
Try this shell script:

    #! /bin/sh
    # This is a bit hacky: we use the -i flag to force the interpreter into 
    # interactive mode after the initial commands are executed.
    # The "proper" way to do this is probably to set up a PYTHONSTARTUP file
    # and put the initial commands in there.
    exec ipython3 --no-banner --no-confirm-exit -i -c '
    from math import *
    import random
    import sys, os, platform
    print("== IPython %s Calculator REPL ==" % platform.python_version())
    '
1 comments

Thank you for the suggestion! I still get the error, unfortunately:

      File "<ipython-input-1-a0531db54fa8>", line 1
        from
            ^
    SyntaxError: invalid syntax
I shall see if it starts working when I upgrade to a distro with a newer IPython.