rocklabs-io / ic-py

Python Agent Library for the DFINITY Internet Computer
MIT License
128 stars 27 forks source link

Exception thrown 'NoneType' object has no attribute 'name' #10

Closed testpuddle closed 2 years ago

testpuddle commented 2 years ago

Running name = agent.query_raw("gvbup-jyaaa-aaaah-qcdwa-cai", "name", encode([])) works. It provides the response: [{'type': 'text', 'value': 'XTC Test'}]

Changing the method from name to symbol as follows: name = agent.query_raw("gvbup-jyaaa-aaaah-qcdwa-cai", "symbol, encode([])) works in DFX and returns ("XTC").

In python, it generates an exception:

Exception has occurred: AttributeError 'NoneType' object has no attribute 'name' File "C:\Users\trrei\py\Untitled-1.py", line 14, in name = agent.query_raw("gvbup-jyaaa-aaaah-qcdwa-cai", "symbol", encode([]))

Both the name and symbol methods are text fields per the info in ic.rocks.

mircial commented 2 years ago

This is fixed on the main branch, but not published to pypi yet, please try to reinstall ic-py:

pip3 uninstall ic-py
git clone git@github.com:rocklabs-io/ic-py.git
cd ic-py
pip3 install ./

Then you should be good to go.

testpuddle commented 2 years ago

Thank you. The package works perfectly under WSL2 with Ubuntu20.04 LTS. :) I could not get it to run under Python 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)] on win32

This is not urgent and when it is repackaged under Pypi it should work.

For your info, I got the following error: ERROR: Command errored out with exit status 1: command: 'C:\Users\dddi\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\dddi\AppData\Local\Temp\pip-req-build-uq7ro8b3\setup.py'"'"'; file='"'"'C:\Users\dddi\AppData\Local\Temp\pip-req-build-uq7ro8b3\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\trrei\AppData\Local\Temp\pip-pip-egg-info-o8kqjc1e' cwd: C:\Users\dddi\AppData\Local\Temp\pip-req-build-uq7ro8b3\ Complete output (7 lines): Traceback (most recent call last): File "", line 1, in File "C:\Users\dddi\AppData\Local\Temp\pip-req-build-uq7ro8b3\setup.py", line 7, in long_description = f.read() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1205: character maps to