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

API does not work #120

Open
chenenjun opened this issue Aug 30, 2022 · 2 comments
Open

API does not work #120

chenenjun opened this issue Aug 30, 2022 · 2 comments

Comments

@chenenjun
Copy link

Describe the bug
I checked the API documentation and wrote the code according to the above test cases, but I didn't get the expected results.
I try to use vmonkey.py directly. It works normally
sys: Ubuntu 14.04 LTS
e.g.

import vipermonkey
vba_code = '''
Dim m1, m2, m3 As String
m1 = "he" & "ll" & Chr(111) & " "
m2 = "w" & Chr(111) & "rl" & Chr(123 Xor 31)
m3 = "!!!"
m1 & m2 & m3
'''
print vipermonkey.eval(vba_code)

output:

Traceback (most recent call last):
  File "my_test.py", line 10, in <module>
    print vipermonkey.eval(vba_code)
  File "/home/ViperMonkey-master/vipermonkey/api.py", line 468, in eval
    return module.eval(context)
  File "/home/ViperMonkey-master/vipermonkey/api.py", line 401, in eval
    self.load_context(context)
  File "/home/ViperMonkey-master/vipermonkey/api.py", line 424, in load_context
    for name, _sub in self.obj.subs.items():
  File "/home/ViperMonkey-master/vipermonkey/api.py", line 451, in obj
    self._obj = _Module(str(self), 0, list(self.code_blocks))
  File "/home/ViperMonkey-master/vipermonkey/core/modules.py", line 113, in __init__
    self._handle_func_decls(tokens)
  File "/home/ViperMonkey-master/vipermonkey/core/modules.py", line 76, in _handle_func_decls
    token.accept(func_visitor)
TypeError: 'NoneType' object is not callable

Expected behavior
Make the APITutorial work as expected

Screenshots
pytest test_api.py
image
image

@decalage2
Copy link
Owner

Indeed ViperMonkey has been modified a lot since the API documentation was written, and I'm not sure the API still works. Nowadays, ViperMonkey is only meant to be run as a script. I need to fix the documentation.

@decalage2 decalage2 self-assigned this Sep 1, 2022
@decalage2 decalage2 added this to the ViperMonkey 1.0.3 milestone Sep 1, 2022
@chenenjun
Copy link
Author

Thanks for the reply.
Looking forward to your update of the API documentation.

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

No branches or pull requests

2 participants