Ask Your Question
0

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 http://trac.sagemath.org

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>
    launcher(unknown)
  File "/usr/bin/sage-notebook", line 135, in __init__
    os.execvp(SAGENB_EXPORT, [SAGENB_EXPORT] + argv)
  File "/usr/lib/python2.7/os.py", line 346, in execvp
    _execvpe(file, args)
  File "/usr/lib/python2.7/os.py", 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
0

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

dan_fulea gravatar image

The file /usr/lib/python2.7/os.py 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)
    else:
        func = execv
        argrest = (args,)
        env = environ

    head, tail = path.split(file)
    if head:
        func(file, *argrest)
        return
    if 'PATH' in env:
        envpath = env['PATH']
    else:
        envpath = defpath
    PATH = envpath.split(pathsep)
    saved_exc = None
    saved_tb = None
    for dir in PATH:
        fullname = path.join(dir, file)
        try:
            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

Stats

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

Seen: 402 times

Last updated: Jul 12 '19