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

bracketed paste \x1b[?2004h issue #248

Open
prowe12 opened this issue Jun 23, 2022 · 3 comments
Open

bracketed paste \x1b[?2004h issue #248

prowe12 opened this issue Jun 23, 2022 · 3 comments

Comments

@prowe12
Copy link

prowe12 commented Jun 23, 2022

I just installed octave and oct2py on a new Mac with the m1 chip and MacOS Monterey Version 12.4.

I am getting the error:

Traceback (most recent call last):
File "/Users/prowe/git-repos/mpl-processing/tests/test_oct2py/test_oct2py.py", line 17, in
oc.addpath(os.getcwd() + '/tests/test_oct2py/')
File "/opt/homebrew/lib/python3.9/site-packages/oct2py/core.py", line 758, in getattr
exist = self._exist(name)
File "/opt/homebrew/lib/python3.9/site-packages/oct2py/core.py", line 709, in _exist
exist = int(resp.split()[-1])
ValueError: invalid literal for int() with base 10: '\x1b[?2004h'

This seems to be due to "\x1b[?2004h" being appended to the beginning and ending of the result of self._engine.eval(cmd, silent=True).strip().

Thus when exist = int(resp.split()[-1]) is run, the final character is '\x1b[?2004h' instead of, e.g. 5 for addpath.

Is there a fix or work-around?

Thank you!

@blink1073
Copy link
Owner

Hi @prowe12, this is a known issue, the workaround is here: pexpect/pexpect#669 (comment)

@prowe12
Copy link
Author

prowe12 commented Jun 24, 2022

Thank you so much! It worked. I'm sorry I missed the known issue - I did spend a lot of time looking but didn't know the keywords to use.

@blink1073
Copy link
Owner

No worries! Yeah it is a hard thing to search for. 😃

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