Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring crashing shell #4

Open
Ymac101 opened this issue Oct 1, 2019 · 3 comments
Open

Docstring crashing shell #4

Ymac101 opened this issue Oct 1, 2019 · 3 comments

Comments

@Ymac101
Copy link

Ymac101 commented Oct 1, 2019

When an illegal character is present in a function's docstring (e.g string.find()) the shell crashes altogether:

In [3]: string.find?
Signature: string.find(s, pattern [, init [, plain]])
Documentation:Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\ilua.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\ilua\consoleapp.py", line 37, in main
    ILuaConsoleApp().run()
  File "c:\python27\lib\site-packages\ilua\consoleapp.py", line 34, in run
    ZMQTerminalIPythonApp.launch_instance(argv=['--kernel', 'lua'])
  File "C:\Users\Yoav\AppData\Roaming\Python\Python27\site-packages\jupyter_core\application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "c:\python27\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
    app.start()
  File "C:\Users\Yoav\AppData\Roaming\Python\Python27\site-packages\jupyter_console\app.py", line 155, in start
    self.shell.mainloop()
  File "C:\Users\Yoav\AppData\Roaming\Python\Python27\site-packages\jupyter_console\ptshell.py", line 508, in mainloop
    self.interact()
  File "C:\Users\Yoav\AppData\Roaming\Python\Python27\site-packages\jupyter_console\ptshell.py", line 500, in interact
    self.run_cell(code, store_history=True)
  File "C:\Users\Yoav\AppData\Roaming\Python\Python27\site-packages\jupyter_console\ptshell.py", line 564, in run_cell
    self.handle_execute_reply(msg_id, timeout=0.05)
  File "C:\Users\Yoav\AppData\Roaming\Python\Python27\site-packages\jupyter_console\ptshell.py", line 592, in handle_execute_reply
    page.page(item['data']['text/plain'])
  File "c:\python27\lib\site-packages\IPython\core\page.py", line 274, in page
    return pager_page(data, start, screen_lines, pager_cmd)
  File "c:\python27\lib\site-packages\IPython\core\page.py", line 201, in pager_page
    print(str_toprint)
  File "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 40, in write
    self.__convertor.write(text)
  File "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 141, in write
    self.write_and_convert(text)
  File "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 166, in write_and_convert
    self.write_plain_text(text, cursor, start)
  File "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
    self.wrapped.write(text[start:end])
  File "c:\python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\xa7' in position 46: character maps to <undefined>
@guysv
Copy link
Owner

guysv commented Oct 1, 2019

hmm, im pretty sure I patched that on 0.2.0, but ill give it a look!

@guysv
Copy link
Owner

guysv commented Oct 1, 2019

works for me on 0.2.1:
are you sure you're using the latest release?
if not, what's your lua's version?

C:\Users\User>ilua
Jupyter console 5.3.0dev

ILua 0.2.1


In [1]: string.find?
Signature: string.find(s, pattern [, init [, plain]])
Documentation:
Looks for the first match of `pattern` (see §6.4.1) in the string `s`. If it
finds a match, then `find` returns the indices of `s` where this occurrence
starts and ends; otherwise, it returns **nil**. A third, optional numeric
argument `init` specifies where to start the search; its default value is 1
and can be negative. A value of **true** as a fourth, optional argument
`plain` turns off the pattern matching facilities, so the function does a
plain "find substring" operation, with no characters in `pattern` being
considered magic. Note that if `plain` is given, then `init` must be given as
well.

If the pattern has captures, then in a successful match the captured values
are also returned, after the two indices.
Path: n/a

@guysv
Copy link
Owner

guysv commented Oct 1, 2019

Wait, my bad. I was actually using a modified version of jupyter_console that fixed this bug
here is my upstream PR:
jupyter/jupyter_console#177
Unfortunately, Jupyter is yet to merge that PR, so I probably set a workaround at the scope of this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants