TypeError: __init__() takes 1
程序员文章站
2024-01-05 16:29:58
...
pymysql连接数据库报错TypeError: init() takes 1 positi
参考:http://www.ncyteng.com/news/show/975.html
pymysql连接数据库报错TypeError: init() takes 1 positional argument but 5 positional arguments
一开始都是这么简单的写,并无报错
db = pymysql.connect(“localhost”, “root”, “root”, “yt”)
因为pymysql的版本有变化,导致不能再这么简单的写了,传参规则变得规范了 主要就是将传参的参数名加上
db = pymysql.connect(host="localhost", user="root", password="root", database="yt", charset="utf8")
推荐阅读
-
TypeError: argument 1 must be 2-item sequence, not int
-
pytorch gpu版本安装外部库报错 TypeError: LoadLibrary() argument 1 must be str, not None
-
TypeError: transpose(): argument 'dim0' (position 1) must be int, not tuple
-
TypeError: __init__() takes 1
-
Python 'takes exactly 1 argument (2 given)' Python error
-
Django在根据models生成数据库表时报 __init__() missing 1 required positional argument: 'on_delete'
-
Angular/ionic加载ArcGISAPIforJavaScript报错:TypeError:esri_loader_1.bootstrapisnotafunction
-
angular 1做项目时 报错TypeError: Cannot read property 'then' of undefined
-
TypeError: module() takes at most 2 arguments (3 given)
-
解决 TypeError: BlockedIPSMiddleware() takes no arguments