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

Error printing empty string; JavascriptError: TypeError: Cannot read properties of null (reading '$method_cache') #2429

Open
clach04 opened this issue May 4, 2024 · 3 comments

Comments

@clach04
Copy link
Contributor

clach04 commented May 4, 2024

Test case for https://brython.info/console.html (works fine in https://brython.info/tests/editor.html )

print('')

Result:

Brython 3.12.3 on Netscape 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Type "help", "copyright", "credits" or "license" for more information.
>>> print('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "VFS.interpreter.py", line 109, in write
    self.interpreter.write(*args,**kw)
  File "VFS.interpreter.py", line 534, in write
    self.cursor_to_end()
  File "VFS.interpreter.py", line 309, in cursor_to_end
    pos=len(last_child.text)
JavascriptError: TypeError: Cannot read properties of null (reading '$method_cache')
>>> 

Seen with Chrome (not tested anything else).

@clach04
Copy link
Contributor Author

clach04 commented May 4, 2024

Presumably this

pos = len(last_child.text)
is the line where the error occurs

Untested possible code change:

pos = len(last_child.text or '')

Assuming ternary works (it seems to work in https://brython.info/console.html).

Not read how to build/test yet (not sure if I will, I was just playing around today).

@PierreQuentel
Copy link
Contributor

Thanks for reporting this @clach04. The issue exists in the current release and on brython.info but is fixed in the current development version. I will publish a new release soon.

@clach04
Copy link
Contributor Author

clach04 commented May 6, 2024

Great! I had chance to do some playing around and have a useful to me mini-app https://clach04.github.io/brython_tip_calc/ (that can generate palindrome totals for tipping ) with essentially no code changes to the Python code... it needs some UI/UX work though as this was a quick experiment. Really nice work on Brython implementation and docs/samples!

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