TypeError: open() takes 0 positional arguments but 2 were given

今天写python脚本的时候,出现如下报错

TypeError: open() takes 0 positional arguments but 2 were given

开始以为是传参的问题,后发现定义方法的时候,跟

f = open(r’d:\test\test.txt’,‘wb’)

file 的open方法冲突了,我自己定义的方法也叫open()

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ChenL2\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2068, in __call__ return self.func(*args) ~~~~~~~~~^^^^^^^ TypeError: handle_scan_input() takes 0 positional arguments but 3 were given ✅ DEBUG: 扫码输入被触发!原始内容 = 'sn112422iTEM1223¥So000001' ⚠️ 检测到中文输入法开启,正在修复... ✅ 成功关闭 IME 🔁 已模拟按下并释放 Shift 键 🆕 开始新扫码序列: 'sn112422iTEM1223¥So000001' ⏳ 等待更多数据... 缓存: sn112422iTEM1223¥So000001 ⏰ 超时自动提交缓存数据: 'sn112422iTEM1223¥So000001' ❌ 无效条码: sn112422iTEM1223¥So000001
最新发布
10-10
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值