gurock / trcli

TR CLI (trcli) is a command line tool for interacting with TestRail.
Mozilla Public License 2.0
47 stars 42 forks source link

Getting error "TypeError: 'type' object is not subscriptable" with trcli v1.3.1 #108

Closed tdnguyen84 closed 1 year ago

tdnguyen84 commented 1 year ago

Problem Statement I'm running trcli on Linux agent and getting the error "TypeError: 'type' object is not subscriptable" even just try with command "trcli --version"

Python 3.6.8
14:20:20   pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
14:20:21   WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
14:20:21   Collecting trcli
14:20:21     Downloading https://files.pythonhosted.org/packages/b7/51/b783b673acbd759fecb0c9ccc146dd4c01d54c4e87a6d1d55df85931e9ea/trcli-1.3.1-py3-none-any.whl
14:20:21   Collecting tqdm (from trcli)
14:20:21     Downloading https://files.pythonhosted.org/packages/47/bb/849011636c4da2e44f1253cd927cfb20ada4374d8b3a4e425416e84900cc/tqdm-4.64.1-py2.py3-none-any.whl (78kB)
14:20:21   Collecting click (from trcli)
14:20:21     Downloading https://files.pythonhosted.org/packages/4a/a8/0b2ced25639fb20cc1c9784de90a8c25f9504a7f18cd8b5397bd61696d7d/click-8.0.4-py3-none-any.whl (97kB)
14:20:21   Requirement already satisfied: pyyaml in /usr/lib64/python3.6/site-packages (from trcli)
14:20:22   Collecting humanfriendly (from trcli)
14:20:22     Downloading https://files.pythonhosted.org/packages/f0/0f/310fb31e39e2d734ccaa2c0fb981ee41f7bd5056ce9bc29b2248bd569169/humanfriendly-10.0-py2.py3-none-any.whl (86kB)
14:20:22   Collecting junitparser (from trcli)
14:20:22     Downloading https://files.pythonhosted.org/packages/7d/fc/d14dc065156780558af1fd306a883f552daf38031fc02c0b2822f3fecc6c/junitparser-2.8.0-py2.py3-none-any.whl
14:20:22   Requirement already satisfied: requests in /usr/local/lib/python3.6/site-packages (from trcli)
14:20:22   Collecting pyserde (from trcli)
14:20:22     Downloading https://files.pythonhosted.org/packages/ae/e2/feded00359535e3e7ee7cb9c26eed9c0469586c5e144d8088668935bf909/pyserde-0.7.0-py3-none-any.whl (69kB)
14:20:22   Requirement already satisfied: importlib-resources; python_version < "3.7" in /usr/local/lib/python3.6/site-packages (from tqdm->trcli)
14:20:22   Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.6/site-packages (from click->trcli)
14:20:22   Collecting future (from junitparser->trcli)
14:20:22     Downloading https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz (829kB)
14:20:23   Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests->trcli)
14:20:23   Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in /usr/local/lib/python3.6/site-packages (from requests->trcli)
14:20:23   Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in /usr/local/lib/python3.6/site-packages (from requests->trcli)
14:20:23   Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests->trcli)
14:20:23   Collecting jinja2 (from pyserde->trcli)
14:20:23     Downloading https://files.pythonhosted.org/packages/20/9a/e5d9ec41927401e41aea8af6d16e78b5e612bca4699d417f646a9610a076/Jinja2-3.0.3-py3-none-any.whl (133kB)
14:20:23   Collecting stringcase (from pyserde->trcli)
14:20:23     Downloading https://files.pythonhosted.org/packages/f3/1f/1241aa3d66e8dc1612427b17885f5fcd9c9ee3079fc0d28e9a3aeeb36fa3/stringcase-1.2.0.tar.gz
14:20:24   Collecting dataclasses; python_version < "3.7" (from pyserde->trcli)
14:20:24     Downloading https://files.pythonhosted.org/packages/fe/ca/75fac5856ab5cfa51bbbcefa250182e50441074fdc3f803f6e76451fab43/dataclasses-0.8-py3-none-any.whl
14:20:24   Collecting typing_inspect>=0.4.0 (from pyserde->trcli)
14:20:24     Downloading https://files.pythonhosted.org/packages/be/01/59b743dca816c4b6ca891b9e0f84d20513cd61bdbbaa8615de8f5aab68c1/typing_inspect-0.8.0-py3-none-any.whl
14:20:24   Collecting backports-datetime-fromisoformat<2,>=1; python_version < "3.7" (from pyserde->trcli)
14:20:24     Downloading https://files.pythonhosted.org/packages/20/15/4bc39da78d00da480ff627398ad25770be1f0c3cf40ea9bc5e9030b441fb/backports-datetime-fromisoformat-1.0.0.tar.gz
14:20:25   Requirement already satisfied: zipp>=3.1.0; python_version < "3.10" in /usr/local/lib/python3.6/site-packages (from importlib-resources; python_version < "3.7"->tqdm->trcli)
14:20:25   Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.6/site-packages (from importlib-metadata; python_version < "3.8"->click->trcli)
14:20:25   Collecting MarkupSafe>=2.0 (from jinja2->pyserde->trcli)
14:20:25     Downloading https://files.pythonhosted.org/packages/fc/d6/57f9a97e56447a1e340f8574836d3b636e2c14de304943836bd645fa9c7e/MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl
14:20:25   Collecting mypy-extensions>=0.3.0 (from typing_inspect>=0.4.0->pyserde->trcli)
14:20:25     Downloading https://files.pythonhosted.org/packages/5c/eb/975c7c080f3223a5cdaff09612f3a5221e4ba534f7039db34c35d95fa6a5/mypy_extensions-0.4.3-py2.py3-none-any.whl
14:20:25   Installing collected packages: tqdm, click, humanfriendly, future, junitparser, MarkupSafe, jinja2, stringcase, dataclasses, mypy-extensions, typing-inspect, backports-datetime-fromisoformat, pyserde, trcli
14:20:25     Running setup.py install for future: started
14:20:26       Running setup.py install for future: finished with status 'done'
14:20:26     Running setup.py install for stringcase: started
14:20:26       Running setup.py install for stringcase: finished with status 'done'
14:20:26     Running setup.py install for backports-datetime-fromisoformat: started
14:20:28       Running setup.py install for backports-datetime-fromisoformat: finished with status 'done'
14:20:28   Successfully installed MarkupSafe-2.0.1 backports-datetime-fromisoformat-1.0.0 click-8.0.4 dataclasses-0.8 future-0.18.2 humanfriendly-10.0 jinja2-3.0.3 junitparser-2.8.0 mypy-extensions-0.4.3 pyserde-0.7.0 stringcase-1.2.0 tqdm-4.64.1 trcli-1.3.1 typing-inspect-0.8.0
14:20:29   Traceback (most recent call last):
14:20:29     File "/usr/local/bin/trcli", line 11, in <module>
14:20:29       sys.exit(cli())
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1128, in __call__
14:20:29       return self.main(*args, **kwargs)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1052, in main
14:20:29       with self.make_context(prog_name, args, **extra) as ctx:
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 914, in make_context
14:20:29       self.parse_args(ctx, args)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1615, in parse_args
14:20:29       rest = super().parse_args(ctx, args)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1370, in parse_args
14:20:29       value, args = param.handle_parse_result(ctx, opts, args)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 2347, in handle_parse_result
14:20:29       value = self.process_value(ctx, value)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 2309, in process_value
14:20:29       value = self.callback(ctx, self, value)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1270, in show_help
14:20:29       echo(ctx.get_help(), color=ctx.color)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 693, in get_help
14:20:29       return self.command.get_help(self)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1295, in get_help
14:20:29       self.format_help(ctx, formatter)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1326, in format_help
14:20:29       self.format_options(ctx, formatter)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1524, in format_options
14:20:29       self.format_commands(ctx, formatter)
14:20:29     File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1588, in format_commands
14:20:29       cmd = self.get_command(ctx, subcommand)
14:20:29     File "/usr/local/lib/python3.6/site-packages/trcli/cli.py", line 210, in get_command
14:20:29       mod = __import__(f"trcli.commands.cmd_{name}", None, None, ["cli"])
14:20:29     File "/usr/local/lib/python3.6/site-packages/trcli/commands/cmd_parse_junit.py", line 6, in <module>
14:20:29       from trcli.api.results_uploader import ResultsUploader
14:20:29     File "/usr/local/lib/python3.6/site-packages/trcli/api/results_uploader.py", line 6, in <module>
14:20:29       from trcli.api.api_request_handler import ApiRequestHandler
14:20:29     File "/usr/local/lib/python3.6/site-packages/trcli/api/api_request_handler.py", line 27, in <module>
14:20:29       class ApiRequestHandler:
14:20:29     File "/usr/local/lib/python3.6/site-packages/trcli/api/api_request_handler.py", line 393, in ApiRequestHandler
14:20:29       def upload_attachments(self, report_results: [dict], results: list[dict], run_id: int):
14:20:29   TypeError: 'type' object is not subscriptable
14:20:29   Process exited with code 1

Note:

d-rede commented 1 year ago

Hi @tdnguyen84

I was able to replicate the issue both on v1.3.1 and v1.3.0 using Python 3.6.8, which is the version on your current TeamCity agent as per your logs. We recommend using Python 3.10.0 and above, which support all the python features used by the trcli, so please make sure your CI agents are running one of those.

Hope this helps and let me know if I can help any further.

Best, Diogo