TypeError: 'type' object is not subscriptable

I'm using a control panel to manage my site:NginxProxyManager

Error: Command failed: certbot certonly --config "/etc/letsencrypt.ini" --cert-name "npm-6" --agree-tos --email "[redacted]" --domains "[redacted]" --authenticator dns-tencentcloud --dns-tencentcloud-credentials "/etc/letsencrypt/credentials/credentials-6"
An unexpected error occurred:
TypeError: 'type' object is not subscriptable
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/certbot-log-ou0k1a19/log or re-run Certbot with -v for more details.

at ChildProcess.exithandler (node:child_process:402:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1100:16)
at Socket. (node:internal/child_process:458:11)
at Socket.emit (node:events:513:28)
at Pipe. (node:net:301:12)

i'm looking for some help.thanks a lot.

1 Like

this sounds like somebody messed up or something else needs updating.

you should go yell at the nginxproxymanager people. :wink:

4 Likes

Hi @Caicaiziya, and welcome to the LE community forum :slight_smile:

Maybe we should see that log file.

2 Likes

i can't find anything else in the log file.
DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
File "/usr/local/bin/certbot", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/certbot/main.py", line 19, in main
return internal_main.main(cli_args)
File "/usr/local/lib/python3.7/dist-packages/certbot/_internal/main.py", line 1835, in main
plugins = plugins_disco.PluginsRegistry.find_all()
File "/usr/local/lib/python3.7/dist-packages/certbot/_internal/plugins/disco.py", line 192, in find_all
cls._load_entry_point(entry_point, plugins)
File "/usr/local/lib/python3.7/dist-packages/certbot/_internal/plugins/disco.py", line 199, in _load_entry_point
plugin_ep = PluginEntryPoint(entry_point)
File "/usr/local/lib/python3.7/dist-packages/certbot/_internal/plugins/disco.py", line 40, in init
self.plugin_cls: Type[interfaces.Plugin] = entry_point.load()
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py", line 2450, in load
return self.resolve()
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py", line 2456, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.7/dist-packages/certbot_dns_tencentcloud/certbot_tencentcloud_plugins.py", line 155, in
class TencentCloudClient:
File "/usr/local/lib/python3.7/dist-packages/certbot_dns_tencentcloud/certbot_tencentcloud_plugins.py", line 251, in TencentCloudClient
def describe_record_list(self, domain: str) -> list[Dict]:
TypeError: 'type' object is not subscriptable
2023-08-20 05:45:54,563:ERROR:certbot._internal.log:An unexpected error occurred:
2023-08-20 05:45:54,564:ERROR:certbot._internal.log:TypeError: 'type' object is not subscriptable

that l in list, it needs to be uppercased.

It's a bug in certbot_dns_tencentcloud

NB: both list and dict need to be lowercased in python 3.9

4 Likes

Don't forget to import it from typing :wink:

2 Likes

thanks for your help.
but i change "l" in certbot_tencentcloud_plugins.py(line 251),and try it again.

An unexpected error occurred:
NameError: name 'List' is not defined

so i still can't slove the problem.and I don't know how to continue.plz tell me about more details. :wink:

1 Like

oops,i can't understand what u mean.
plz tell me how to fix it.
I appreciate it.

At the top of the file you just modified there's also:

from typing import Dict

You should change that to:

from typing import Dict,List
2 Likes

Oh dear,i delete "list",and it works.

/usr/local/lib/python3.7/dist-packages/certbot_dns_tencentcloud/certbot_tencentcloud_plugins.py
change line 251
def describe_record_list(self, domain: str) -> list[Dict]:
to
def describe_record_list(self, domain: str) -> [Dict]:

1 Like

Yeah, type hinting isn't actually required for the actual working of the code. I think, if you're removing the type hinting partly, you can better remove it entirely:

def describe_record_list(self, domain: str):
1 Like

oh i just used it on my selfhost,i don't understand a lot of programing.so,i'll keep it if it still works.
i don't konw what this mean. (-> [Dict])

It's for type hinting. It's not necessary for the proper functioning of the code itself.

1 Like

I've suggested the fix upstream:

3 Likes

Thank you for making a contribution, you are such a dedicated person and this community has such a great vibe!

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.