Ask Your Question

Convert existing notebook to Jupyter

asked 2019-07-12 14:09:40 +0100

fylou gravatar image

updated 2019-08-29 18:49:41 +0100

FrédéricC gravatar image

Hi, I try to pass from sagenb to jupyter. I follow the recommandation on

When I run the command

sage -n export --list

I obtain the following error.

Traceback (most recent call last):
  File "/usr/bin/sage-notebook", line 266, in <module>
  File "/usr/bin/sage-notebook", line 135, in __init__
    os.execvp(SAGENB_EXPORT, [SAGENB_EXPORT] + argv)
  File "/usr/lib/python2.7/", line 346, in execvp
    _execvpe(file, args)
  File "/usr/lib/python2.7/", line 382, in _execvpe
    func(fullname, *argrest)
OSError: [Errno 2] No such file or directory

Thanks for your help

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-07-12 18:12:55 +0100

dan_fulea gravatar image

The file /usr/lib/python2.7/ has on my machine the following content around the critical line marked with <---- below:

def _execvpe(file, args, env=None):
    if env is not None:
        func = execve
        argrest = (args, env)
        func = execv
        argrest = (args,)
        env = environ

    head, tail = path.split(file)
    if head:
        func(file, *argrest)
    if 'PATH' in env:
        envpath = env['PATH']
        envpath = defpath
    PATH = envpath.split(pathsep)
    saved_exc = None
    saved_tb = None
    for dir in PATH:
        fullname = path.join(dir, file)
            func(fullname, *argrest)    # <---- CRITICAL LINE Number 382 in the error mess
        except error, e:
            tb = sys.exc_info()[2]
            if (e.errno != errno.ENOENT and e.errno != errno.ENOTDIR
                and saved_exc is None):
                saved_exc = e
                saved_tb = tb
    if saved_exc:
        raise error, saved_exc, saved_tb
    raise error, e, tb

(It is already pretty bad that the code uses variables like dir and file for the own purposes, but let it be so, we have an other problem.)

As seen, for each dir in the PATH we try to do something. We call func, which is either execve or execv, against the dir joined with file, and there are also some ** arguments... The error shows that the PATH and\or the file runs into an error.

My strategy in such cases is to edit the py-file inserting a print in the loop with the error. (This is one beautiful profit of having open sources.) Which is now exactly the "bad path" and/or "bad file"?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-07-12 14:09:40 +0100

Seen: 324 times

Last updated: Jul 12 '19