iotile / iotile/typedargs

Import errors obscured on command line

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Description

When connected to a tile_manager, and invoke "describe_tile", it will attempt to decode get_type. Currently, it is possible to get to this point without having the proper dependencies installed (and the file with the types will not get imported). The error that typedargs shows looks like this:

```(TileManager) describe_tile 1
ArgumentError: get_type called on unknown type
Additional Information:
type: fw_tiledescriptor
failed_external_sources: ['Entry point group: iotile.type_package, name: lib_controller_types']
```

However, when invoking the same series of commands in a python shell, the full error message looks like this:
```>>> t.describe_tile(1)
ERROR:root:Error loading external type source from entry point, group: iotile.type_package, name: lib_controller_types
Traceback (most recent call last):
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/typedargs/typeinfo.py", line 273, in get_type
mod = entry.load()
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in load
return self.resolve()
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2330, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/iotile_support_lib_controller_3/lib_controller_types/__init__.py", line 2, in
from . import fw_graphnode
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/iotile_support_lib_controller_3/lib_controller_types/fw_graphnode.py", line 1, in
from pyparsing import Word, Regex, nums, hexnums, Literal, Optional, Group, oneOf, QuotedString, ParseException
ModuleNotFoundError: No module named 'pyparsing'
Traceback (most recent call last):
File "", line 1, in
File "", line 2, in describe_tile
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/typedargs/utils.py", line 34, in _check_and_execute
retval = func(*convargs, **convkw)
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/iotile_support_lib_controller_3/tilemanager.py", line 27, in describe_tile
return type_system.convert_to_type(res['buffer'], 'fw_tiledescriptor')
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/typedargs/typeinfo.py", line 89, in convert_to_type
return self.convert_from_binary(value, typename, **kwargs)
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/typedargs/typeinfo.py", line 107, in convert_from_binary
size = self.get_type_size(type)
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/typedargs/typeinfo.py", line 124, in get_type_size
typeobj = self.get_type(type)
File "/Users/mrunchey/ota_dev/lib/python3.6/site-packages/typedargs/typeinfo.py", line 295, in get_type
raise ArgumentError("get_type called on unknown type", type=type_name, failed_external_sources=[x[0] for x in self.failed_sources])
typedargs.exceptions.ArgumentError: ArgumentError: get_type called on unknown type
Additional Information:
type: fw_tiledescriptor
failed_external_sources: ['Entry point group: iotile.type_package, name: lib_controller_types']
```

the typeinfo.py ArgumentError handler should include the ModuleNotFoundError.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.