Open LintangWisesa opened 3 years ago
Can try disabling xsrf check in your jupyter config and see if that works?
Can try disabling xsrf check in your jupyter config and see if that works?
I've just tried to disable xsrf check by adding this line:
c.NotebookApp.disable_check_xsrf = True
on jupyter_notebook_config.py
, then re-installing & re-setting jupyterlab-email
. Still do the same & got this on jupyter logs:
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/email/run', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "c:\python37\lib\site-packages\tornado\web.py", line 1697, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "c:\python37\lib\site-packages\jupyterlab_email\handlers.py", line 96, in post
postprocessor)
File "c:\python37\lib\site-packages\jupyterlab_email\_email.py", line 40, in make_email
name = path.rsplit('/', 1)[1].rsplit('.', 1)[0]
IndexError: list index out of range
[E 12:45:29.467 LabApp] {
"Host": "localhost:8888",
"Connection": "keep-alive",
"Content-Length": "11106",
"Accept": "application/json, text/javascript, text/plain",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36",
"Content-Type": "application/json",
"Origin": "http://localhost:8888",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "http://localhost:8888/lab",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"Cookie": "username-localhost-8889=\"2|1:0|10:1604300619|23:username-localhost-8889|44:MTI0MDNmZTdkMjNlNGY5ZmE5MTU1MmE5NGZkMWE1NjQ=|63fc9ced21059d4da5aa193c153d48b9fb2b517c98e13ed95166fc44c57d83ac\"; _xsrf=2|2512cbf8|e8222b9ce08b37b823e3e0fa9371ce28|1605277283; username-localhost-8888=\"2|1:0|10:1606715128|23:username-localhost-8888|44:OTZhZGU0OTM1NzAwNDI0NzgxMDhlMTg3NjZmZmEyNmE=|d9feab22bcab4dc7b3b3fa869f3b23bd41b534ac65bb79a8acf4cb3051c19294\""
}
[E 12:45:29.468 LabApp] 500 POST /email/run (::1) 5.00ms referer=http://localhost:8888/lab
Its HTTP status code = 500, internal server error?
I got the same error. Any solution?
@Lanzzzzz did you disable xsrf and get the same 500?
@Lanzzzzz did you disable xsrf and get the same 500?
Yes, I did, and I also got a warning email from Google saying a login attempt from a non-google app has been blocked. Could that be the reason for the error 500?
Yep you need to allow less secure apps in google.
I allowed less secure apps in google. Still doesn't work. My error logs:
[E 16:21:01.774 NotebookApp] Uncaught exception POST /email/run (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri
='/email/run', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
File "D:\Python\Anaconda3\lib\site-packages\tornado\web.py", line 1701, in
_execute
result = method(*self.path_args, **self.path_kwargs)
File "D:\Python\Anaconda3\lib\site-packages\jupyterlab_email\handlers.py",
line 108, in post
raise Exception('Error during conversion!')
Exception: Error during conversion!
[E 16:21:01.785 NotebookApp] {
"Host": "localhost:8888",
"Connection": "keep-alive",
"Content-Length": "1318097",
"Sec-Ch-Ua": "\"Google Chrome\";v=\"87\", \"\\\"Not;A\\\\Brand\";v=\"99\",
\"Chromium\";v=\"87\"",
"Accept": "application/json, text/javascript, text/plain",
"Sec-Ch-Ua-Mobile": "?0",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36",
"Content-Type": "application/json",
"Origin": "http://localhost:8888",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Dest": "empty",
"Referer": "http://localhost:8888/lab",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,ja;q=0.8",
"Cookie": "_xsrf=2|01bae03d|bb4a8eb5d38171ba86722404b08cdb7a|1607113184; u
sername-localhost-8889=\"2|1:0|10:1607619128|23:username-localhost-8889|44:OWVlM
jg3ZTk5NzQxNGVlZWJlN2RlOTlhMWE3YWZmYmE=|f2a6d8e178c9605f82855bf74cb47e436bb5bfbb
f596c876f9e50d359523e0ce\"; username-localhost-8888=\"2|1:0|10:1607629855|23:use
rname-localhost-8888|44:MDU4YjIzYmY3N2QxNDZkZmIxOTk5OTNlYTgyNTc5OGM=|419d4d926ef
ef82cae9b708839ff7d069e11a88cb8d486b95cdc7180c9d5b61f\""
}
[E 16:21:01.788 NotebookApp] 500 POST /email/run (127.0.0.1) 3420.20ms referer=h
ttp://localhost:8888/lab
Exception: Error during conversion!
indicates it was unable to nbconvert
the notebook. Does nbconvert
ing the notebook to html work for you normally?
Exception: Error during conversion!
indicates it was unable tonbconvert
the notebook. Doesnbconvert
ing the notebook to html work for you normally?
I tried nbconvert
directly. It works fine.
And I also added some printout in _email.py
to try to find the problem.
I found the path
looks abnormal with a /
.
output:
111111111111111111111111111111111111111111111111111111111111111111
html
mammal_sound_test
C:\Users\Lanz\Desktop/mammal_sound_test.ipynb
D:\Python\Anaconda3\lib\site-packages\jupyterlab_email\templates\hide_code_cells
_html_email.tpl
1
<html><h1>Notebook Run error has occurred - see raw log for details</h1></html>
111111111111111111111111111111111111111111111111111111111111111111
I also added a printout in your nbconvert.py
,
output:
22222222222222222222
['D:\\Python\\Anaconda3\\python.exe', '-m', 'nbconvert', '--to', 'html', '--temp
late', 'D:\\Python\\Anaconda3\\lib\\site-packages\\jupyterlab_email\\templates\\
hide_code_cells_html_email.tpl', 'C:\\Users\\Lanz\\AppData\\Local\\Temp\\tmp9h74
2wku\\mammal_sound_test', '--output', 'mammal_sound_test.html']
I found that the path of the target file is in a temp folder, 'C:\\Users\\Lanz\\AppData\\Local\\Temp\\tmp9h742wku\\mammal_sound_test'
, rather than the original absolute path and it also doesn't have the extension .ipynb
.
Could that info be helpful?
@Lanzzzzz this is super helpful, I think I'm relying on /
instead of os.path.sep
in a few places since jupyter treats paths in the unix style even on windows. I will have to go through and make sure that I normalize paths from jupyter to be windows-compliant
I've followed all the setup instructions: install
jupyterlab_email
package,jupyterlab_email
JupyterLab extension & configurejupyter_notebook_config.py
. When JupyterLab activated, first it will ask for the email password. Under JupyterLab File menu there is an option to Send Emails. But when I want to send an email, there is a popup message:On Jupyter logs I have these following lines:
What's wrong with this? Is there any solution for this? Thanks in advance.