jupyter-tabnine icon indicating copy to clipboard operation
jupyter-tabnine copied to clipboard

TypeError: write() only accepts bytes, unicode, and dict objects

Open ucsky opened this issue 4 years ago • 3 comments

(mediadata) bob@hostname:~/project/media_soe$ jupyter notebook --port 5000 --no-browser
[I 12:01:24.641 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.4.1
[INFO 2020-03-31 12:01:24.642 TabNine]:  install dir: /home/bob/.virtualenvs/mediadata/lib/python3.6/site-packages/jupyter_tabnine
[INFO 2020-03-31 12:01:24.643 TabNine]: TabNine binary already exists in /home/bob/.virtualenvs/mediadata/lib/python3.6/site-packages/jupyter_tabnine/binaries/2.5.1/x86_64-unknown-linux-gnu/TabNine ignore downloading
[WARNING 2020-03-31 12:01:27.313 TabNine]:  wrong response of turning on semantic completion
[I 12:01:27.315 NotebookApp] Serving notebooks from local directory: /home/bob/project/media_soe
[I 12:01:27.315 NotebookApp] The Jupyter Notebook is running at:
[I 12:01:27.315 NotebookApp] http://localhost:5000/?token=0bb320619291829c2f74580820b382e36233bfec349e36e6
[I 12:01:27.315 NotebookApp]  or http://127.0.0.1:5000/?token=0bb320619291829c2f74580820b382e36233bfec349e36e6
[I 12:01:27.315 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:01:27.325 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/bob/.local/share/jupyter/runtime/nbserver-7983-open.html
    Or copy and paste one of these URLs:
        http://localhost:5000/?token=0bb320619291829c2f74580820b382e36233bfec349e36e6
     or http://127.0.0.1:5000/?token=0bb320619291829c2f74580820b382e36233bfec349e36e6
[W 12:01:32.510 NotebookApp] 404 GET /api/kernels/20be7e9c-d6a9-4a1e-a457-e147e5f9bc48/channels?session_id=e52034af673c417f9fd8db20a0c906bf (127.0.0.1): Kernel does not exist: 20be7e9c-d6a9-4a1e-a457-e147e5f9bc48
[W 12:01:32.549 NotebookApp] 404 GET /api/kernels/20be7e9c-d6a9-4a1e-a457-e147e5f9bc48/channels?session_id=e52034af673c417f9fd8db20a0c906bf (127.0.0.1) 45.41ms referer=None
[W 12:01:48.582 NotebookApp] Replacing stale connection: 20be7e9c-d6a9-4a1e-a457-e147e5f9bc48:e52034af673c417f9fd8db20a0c906bf
[I 12:01:52.360 NotebookApp] 302 GET / (127.0.0.1) 0.91ms
[I 12:02:04.074 NotebookApp] Kernel started: 5d2f6a7a-b8b9-4ff0-9988-86dd3126e0ca
[E 12:02:16.210 NotebookApp] Uncaught exception GET /tabnine?data=%7B%22version%22%3A%221.0.7%22%2C%22request%22%3A%7B%22Autocomplete%22%3A%7B%22filename%22%3A%2201-print%2Fnotebook%2Flists-of-prints.py%22%2C%22before%22%3A%22%23%25config%20IPCompleter.greedy%3DTrue%5Cnimport%20pandas%20as%20pd%5Cnimport%20numpy%20as%20np%5Cndf%20%3D%20pd.P%22%2C%22after%22%3A%22%5Cndf%20%3D%20pd.DataFrame()%5Cnpath_data%20%3D%20%5C%22..%2Fdata%2F2019-10-22_Toutes_les_fiches_techniques_Print.xls%5C%22%5Cndf%20%3D%20pd.read_excel(path_data)%5Cndf.head()%5Cndf.columns%5Cndf.drop(%5B%27Unnamed%3A%200%27%5D%2C%20axis%3D1%2C%20inplace%3DTrue)%5Cndf.head()%5Cndf.columns%5Cnlcol%20%3D%20%5B%27number%27%2C%20%27wbs%27%2C%20%27name%27%2C%20%27pm_name%27%2C%27status%27%2C%27finished%27%2C%27recording_type%27%2C%27univers%27%2C%27notes%27%2C%27client%27%2C%27product%27%2C%27industrie%27%2C%27gfk_dep%27%2C%27collect%27%5D%5Cndf.columns%20%3D%20lcol%5Cndf.head()%5Cnimport%20numpy%20as%20np%5Cnimport%20pandas%20as%20pd%5Cnfrom%20pandas_profiling%20import%20ProfileReport%5Cnprofile%20%3D%20ProfileReport(df%2C%20title%3D%27Pandas%20Profiling%20Report%27%2C%20html%3D%7B%27style%27%3A%7B%27full_width%27%3ATrue%7D%7D)%5Cnprofile%5Cn%23df.number%20%3D%20df.number.str.replace(%27_001%27%2C%20%27%27).map(int)%5Cndf.number%20%3D%20df.number.astype(str).str%5B0%3A6%5D.map(int)%5Cndf.head()%5Cn%23%20Number%20of%20unique%20surveys%5Cnlen(df)%5Cnlen(df.number.unique())%5Cn**142**%5Cn%25%25bash%5Cnls%20~%2Fmnt%2FWorkflow%2FCrossteam%2FSurveys%2F*%2F%5Cnimport%20glob%5Cnimport%20os%5Cnlsurvey%20%3D%20glob.glob(os.environ%5B%27HOME%27%5D%2B%27%2Fmnt%2FWorkflow%2FCrossteam%2FSurveys%2F*%2F*%27)%5Cnlidfr%20%3D%20%5B%20int(i.split(%27%2F%27)%5B8%5D.split(%27%20-%20%27)%5B0%5D.replace(%27%20%27%2C%27%27))%20for%20i%20in%20lsurvey%5D%5Cnlidfr%5Cndf.number.tolist()%5Cnset(df.number.tolist())%20%26%20set(lidfr)%5Cnfind%20%2F%20-type%20d%20-name%20%5C%22dir-name-here%5C%22%22%2C%22region_includes_beginning%22%3Atrue%2C%22region_includes_end%22%3Atrue%2C%22max_num_results%22%3A10%7D%7D%7D (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:5000', method='GET', uri='/tabnine?data=%7B%22version%22%3A%221.0.7%22%2C%22request%22%3A%7B%22Autocomplete%22%3A%7B%22filename%22%3A%2201-print%2Fnotebook%2Flists-of-prints.py%22%2C%22before%22%3A%22%23%25config%20IPCompleter.greedy%3DTrue%5Cnimport%20pandas%20as%20pd%5Cnimport%20numpy%20as%20np%5Cndf%20%3D%20pd.P%22%2C%22after%22%3A%22%5Cndf%20%3D%20pd.DataFrame()%5Cnpath_data%20%3D%20%5C%22..%2Fdata%2F2019-10-22_Toutes_les_fiches_techniques_Print.xls%5C%22%5Cndf%20%3D%20pd.read_excel(path_data)%5Cndf.head()%5Cndf.columns%5Cndf.drop(%5B%27Unnamed%3A%200%27%5D%2C%20axis%3D1%2C%20inplace%3DTrue)%5Cndf.head()%5Cndf.columns%5Cnlcol%20%3D%20%5B%27number%27%2C%20%27wbs%27%2C%20%27name%27%2C%20%27pm_name%27%2C%27status%27%2C%27finished%27%2C%27recording_type%27%2C%27univers%27%2C%27notes%27%2C%27client%27%2C%27product%27%2C%27industrie%27%2C%27gfk_dep%27%2C%27collect%27%5D%5Cndf.columns%20%3D%20lcol%5Cndf.head()%5Cnimport%20numpy%20as%20np%5Cnimport%20pandas%20as%20pd%5Cnfrom%20pandas_profiling%20import%20ProfileReport%5Cnprofile%20%3D%20ProfileReport(df%2C%20title%3D%27Pandas%20Profiling%20Report%27%2C%20html%3D%7B%27style%27%3A%7B%27full_width%27%3ATrue%7D%7D)%5Cnprofile%5Cn%23df.number%20%3D%20df.number.str.replace(%27_001%27%2C%20%27%27).map(int)%5Cndf.number%20%3D%20df.number.astype(str).str%5B0%3A6%5D.map(int)%5Cndf.head()%5Cn%23%20Number%20of%20unique%20surveys%5Cnlen(df)%5Cnlen(df.number.unique())%5Cn**142**%5Cn%25%25bash%5Cnls%20~%2Fmnt%2FWorkflow%2FCrossteam%2FSurveys%2F*%2F%5Cnimport%20glob%5Cnimport%20os%5Cnlsurvey%20%3D%20glob.glob(os.environ%5B%27HOME%27%5D%2B%27%2Fmnt%2FWorkflow%2FCrossteam%2FSurveys%2F*%2F*%27)%5Cnlidfr%20%3D%20%5B%20int(i.split(%27%2F%27)%5B8%5D.split(%27%20-%20%27)%5B0%5D.replace(%27%20%27%2C%27%27))%20for%20i%20in%20lsurvey%5D%5Cnlidfr%5Cndf.number.tolist()%5Cnset(df.number.tolist())%20%26%20set(lidfr)%5Cnfind%20%2F%20-type%20d%20-name%20%5C%22dir-name-here%5C%22%22%2C%22region_includes_beginning%22%3Atrue%2C%22region_includes_end%22%3Atrue%2C%22max_num_results%22%3A10%7D%7D%7D', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/bob/.virtualenvs/mediadata/lib/python3.6/site-packages/tornado/web.py", line 1703, in _execute
        result = await result
      File "/home/bob/.virtualenvs/mediadata/lib/python3.6/site-packages/jupyter_tabnine/handler.py", line 14, in get
        self.write(response)
      File "/home/bob/.virtualenvs/mediadata/lib/python3.6/site-packages/tornado/web.py", line 834, in write
        raise TypeError(message)
    TypeError: write() only accepts bytes, unicode, and dict objects
[E 12:02:16.214 NotebookApp] {
      "Host": "localhost:5000",
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0",
      "Accept": "*/*",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "X-Requested-With": "XMLHttpRequest",
      "Connection": "keep-alive",
      "Referer": "http://localhost:5000/notebooks/01-print/notebook/lists-of-prints.ipynb",
      "Cookie": "username-localhost-5000=\"2|1:0|10:1585646585|23:username-localhost-5000|44:YjcwMmI0NjJhMDg1NDBkY2JhOTNlY2JmOGU0MDE0NTM=|b0dca45e70ea81d989d8a8f32cba9415d7a79358fb8975812ed7a4f43ae1f845\"; _xsrf=2|a827a59c|8bd2453659d2d4eb00d65b78172de365|1583854181; csrftoken=GEFigwPHZbf42XpAMDdrKSt1XNMuzWNz13UGtWil7j4cBKe3LkQwPgGp423VYjM3"
    }
[E 12:02:16.214 NotebookApp] 500 GET /tabnine?data=%7B%22version%22%3A%221.0.7%22%2C%22request%22%3A%7B%22Autocomplete%22%3A%7B%22filename%22%3A%2201-print%2Fnotebook%2Flists-of-prints.py%22%2C%22before%22%3A%22%23%25config%20IPCompleter.greedy%3DTrue%5Cnimport%20pandas%20as%20pd%5Cnimport%20numpy%20as%20np%5Cndf%20%3D%20pd.P%22%2C%22after%22%3A%22%5Cndf%20%3D%20pd.DataFrame()%5Cnpath_data%20%3D%20%5C%22..%2Fdata%2F2019-10-22_Toutes_les_fiches_techniques_Print.xls%5C%22%5Cndf%20%3D%20pd.read_excel(path_data)%5Cndf.head()%5Cndf.columns%5Cndf.drop(%5B%27Unnamed%3A%200%27%5D%2C%20axis%3D1%2C%20inplace%3DTrue)%5Cndf.head()%5Cndf.columns%5Cnlcol%20%3D%20%5B%27number%27%2C%20%27wbs%27%2C%20%27name%27%2C%20%27pm_name%27%2C%27status%27%2C%27finished%27%2C%27recording_type%27%2C%27univers%27%2C%27notes%27%2C%27client%27%2C%27product%27%2C%27industrie%27%2C%27gfk_dep%27%2C%27collect%27%5D%5Cndf.columns%20%3D%20lcol%5Cndf.head()%5Cnimport%20numpy%20as%20np%5Cnimport%20pandas%20as%20pd%5Cnfrom%20pandas_profiling%20import%20ProfileReport%5Cnprofile%20%3D%20ProfileReport(df%2C%20title%3D%27Pandas%20Profiling%20Report%27%2C%20html%3D%7B%27style%27%3A%7B%27full_width%27%3ATrue%7D%7D)%5Cnprofile%5Cn%23df.number%20%3D%20df.number.str.replace(%27_001%27%2C%20%27%27).map(int)%5Cndf.number%20%3D%20df.number.astype(str).str%5B0%3A6%5D.map(int)%5Cndf.head()%5Cn%23%20Number%20of%20unique%20surveys%5Cnlen(df)%5Cnlen(df.number.unique())%5Cn**142**%5Cn%25%25bash%5Cnls%20~%2Fmnt%2FWorkflow%2FCrossteam%2FSurveys%2F*%2F%5Cnimport%20glob%5Cnimport%20os%5Cnlsurvey%20%3D%20glob.glob(os.environ%5B%27HOME%27%5D%2B%27%2Fmnt%2FWorkflow%2FCrossteam%2FSurveys%2F*%2F*%27)%5Cnlidfr%20%3D%20%5B%20int(i.split(%27%2F%27)%5B8%5D.split(%27%20-%20%27)%5B0%5D.replace(%27%20%27%2C%27%27))%20for%20i%20in%20lsurvey%5D%5Cnlidfr%5Cndf.number.tolist()%5Cnset(df.number.tolist())%20%26%20set(lidfr)%5Cnfind%20%2F%20-type%20d%20-name%20%5C%22dir-name-here%5C%22%22%2C%22region_includes_beginning%22%3Atrue%2C%22region_includes_end%22%3Atrue%2C%22max_num_results%22%3A10%7D%7D%7D (127.0.0.1) 6.58ms referer=http://localhost:5000/notebooks/01-print/notebook/lists-of-prints.ipynb

ucsky avatar Mar 31 '20 12:03 ucsky

Are you using python2?

wenmin-wu avatar Apr 20 '20 00:04 wenmin-wu

Are you using python2?

I am using python3.6 and get the same error.

    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/root/.local/lib/python3.6/site-packages/jupyter_tabnine/handler.py", line 14, in get
        self.write(response)
      File "/usr/local/lib/python3.6/dist-packages/tornado/web.py", line 841, in write
        raise TypeError(message)
    TypeError: write() only accepts bytes, unicode, and dict objects

Does it works with python3.6 ?

quydx avatar Nov 27 '20 04:11 quydx

Using python3.8 conda in conda env and the same error.

Traceback (most recent call last):
      File "/home/xbankov/miniconda3/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/home/xbankov/.local/lib/python3.8/site-packages/jupyter_tabnine/handler.py", line 14, in get
        self.write(response)
      File "/home/xbankov/miniconda3/lib/python3.8/site-packages/tornado/web.py", line 841, in write
        raise TypeError(message)
    TypeError: write() only accepts bytes, unicode, and dict objects

xbankov avatar Jul 27 '21 13:07 xbankov