TypeError: Item in ''from list'' not a string for escops
TypeError: Item in ''from list'' not a string for escops
我正在尝试编写一个 python 脚本(在 window 10 中),将字符串数据发送到热敏 (ESC/POS) 打印机。我正在关注 this tutorial,但我无法将示例代码添加到 运行。
当我尝试 运行 遵循代码
时出现 "TypeError: Item in ''from list'' not a string" 错误
from escpos import *
Epson = escpos.Escpos(0x04b8,0x0202,0)
Epson.text("Hello World\n")
你们能告诉我错误代码是什么意思吗?我该如何解决?我刚开始编码 python 并且安装了 python 2.7.12 和 escpos。
谢谢!
我是 python-escpos 的维护者。您刚刚在文档中发现了错误的段落。 -_-
我刚刚在 GitHub 上创建了一个问题,这将尽快修复。
针对您的问题:
您必须实例化一个 USB-Printer. (I am assuming you are using a USB-printer, otherwise please take another one from the list of available printer implementations.) You should get along with this tutorial。
代码应该大致如下所示:
from escpos.printer import Usb
p = Usb(0x04b8,0x0202) # these values depend on your printer
p.text("Hello World\n")
我正在尝试编写一个 python 脚本(在 window 10 中),将字符串数据发送到热敏 (ESC/POS) 打印机。我正在关注 this tutorial,但我无法将示例代码添加到 运行。
当我尝试 运行 遵循代码
时出现 "TypeError: Item in ''from list'' not a string" 错误 from escpos import *
Epson = escpos.Escpos(0x04b8,0x0202,0)
Epson.text("Hello World\n")
你们能告诉我错误代码是什么意思吗?我该如何解决?我刚开始编码 python 并且安装了 python 2.7.12 和 escpos。
谢谢!
我是 python-escpos 的维护者。您刚刚在文档中发现了错误的段落。 -_- 我刚刚在 GitHub 上创建了一个问题,这将尽快修复。
针对您的问题:
您必须实例化一个 USB-Printer. (I am assuming you are using a USB-printer, otherwise please take another one from the list of available printer implementations.) You should get along with this tutorial。
代码应该大致如下所示:
from escpos.printer import Usb
p = Usb(0x04b8,0x0202) # these values depend on your printer
p.text("Hello World\n")