You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used npm to install crypto-js so I had to change the require to not have the ./
this works properly if done in pure JS from pmjs, so the problem must be related to JS<>Python layer
npm init
npm i crypto-js
[~/test] dev-wes:wes# pmjs
Welcome to PythonMonkey v0.3.0.
Type ".help" for more information.
> CryptoJS = require('crypto-js')
...
> text = CryptoJS.MD5('123456').toString()
'e10adc3949ba59abbe56e057f20f883e'
> text = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse('123456'))
'MTIzNDU2'
>
npm init
npm i crypto-js
[~/test] dev-wes:wes# python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pythonmonkey import eval as js_eval, require as js_require
>>> CryptoJS = js_require('crypto-js')
>>> CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse('123456'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pythonmonkey.SpiderMonkeyError: Error in file evaluate, on line 59:
TypeError: map is undefined
Stack Trace:
stringify@evaluate:59:22
>>>
I just tried @wesgarland's minimal test case on that branch, and it works great, so you have that to look forward to (as this is effectively a duplicate of #172) .
Activity
hjdhnx commentedon Feb 29, 2024
hjdhnx commentedon Feb 29, 2024
it's the same as npm require
wesgarland commentedon Feb 29, 2024
pmjs, so the problem must be related to JS<>Python layerwesgarland commentedon Feb 29, 2024
~ minimal test case
wesgarland commentedon Feb 29, 2024
In
crypto-js/enc-base64.js, I think this is blowing up on line 59 becausethis._mapin the stringify method is undefined.This implies that PythonMonkey is invoking
CryptoJS.enc.Base64.stringifywith the wrongthiswesgarland commentedon Feb 29, 2024
@hjdhnx - this is probably-fixed in PR 227. Stay tuned, I expect a new release in a week or two with that PR landed.
zollqir commentedon Feb 29, 2024
I just tried @wesgarland's minimal test case on that branch, and it works great, so you have that to look forward to (as this is effectively a duplicate of #172) .
wesgarland commentedon Feb 29, 2024
Confirmed fixed on main already as well - 0.3.1.dev39+67e65d0
hjdhnx commentedon Mar 1, 2024
oh thank you for fix this bug, I test ok

hjdhnx commentedon Mar 1, 2024
pythonmonkey-0.3.1.dev42+6b5fb9d-cp38-cp38-win_amd64.whl fixed this bug