bacnet_scan output a csv file error TypeError: a bytes-like object is required, not 'str'
bacnet_scan output a csv file error TypeError: a bytes-like object is required, not 'str'
当 运行 bacnet_scan.py 看起来像这样:
(volttron) (base) bartlino@bartlino-Latitude-E5530-non-vPro:~/Desktop/volttron/scripts/bacnet$ python bacnet_scan.py
Device Address = <Address 192.168.0.190>
Device Id = 0
maxAPDULengthAccepted = 1476
segmentationSupported = noSegmentation
vendorID = 245
Device Address = <Address 192.168.0.102>
Device Id = 3056183
maxAPDULengthAccepted = 1024
segmentationSupported = segmentedBoth
vendorID = 842
Device Address = <RemoteStation 12345:2>
Device Id = 201201
maxAPDULengthAccepted = 286
segmentationSupported = noSegmentation
vendorID = 11
尝试使用 python bacnet_scan.py --csv-out ~/Desktop/volttron/configs/test_mult.csv
添加 csv 文件输出
我收到一个错误:
Traceback (most recent call last):
File "bacnet_scan.py", line 203, in <module>
this_csv_file.writeheader()
File "/home/bartlino/anaconda3/lib/python3.8/csv.py", line 143, in writeheader
return self.writerow(header)
File "/home/bartlino/anaconda3/lib/python3.8/csv.py", line 154, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
TypeError: a bytes-like object is required, not 'str'
有什么建议吗?
如果您没有使用最新的开发分支,我建议您先尝试一下,因为 PR accepted after the 8.0 release 修复了此脚本输出中与字节与字符串相关的问题。我也不确定它们将如何交互,但您目前似乎激活了 2 个虚拟环境,这可能会干扰某些版本控制...因为它的 Python3.8 对于您的 Anaconda,我是对此表示怀疑,但值得考虑。
当 运行 bacnet_scan.py 看起来像这样:
(volttron) (base) bartlino@bartlino-Latitude-E5530-non-vPro:~/Desktop/volttron/scripts/bacnet$ python bacnet_scan.py
Device Address = <Address 192.168.0.190>
Device Id = 0
maxAPDULengthAccepted = 1476
segmentationSupported = noSegmentation
vendorID = 245
Device Address = <Address 192.168.0.102>
Device Id = 3056183
maxAPDULengthAccepted = 1024
segmentationSupported = segmentedBoth
vendorID = 842
Device Address = <RemoteStation 12345:2>
Device Id = 201201
maxAPDULengthAccepted = 286
segmentationSupported = noSegmentation
vendorID = 11
尝试使用 python bacnet_scan.py --csv-out ~/Desktop/volttron/configs/test_mult.csv
我收到一个错误:
Traceback (most recent call last):
File "bacnet_scan.py", line 203, in <module>
this_csv_file.writeheader()
File "/home/bartlino/anaconda3/lib/python3.8/csv.py", line 143, in writeheader
return self.writerow(header)
File "/home/bartlino/anaconda3/lib/python3.8/csv.py", line 154, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
TypeError: a bytes-like object is required, not 'str'
有什么建议吗?
如果您没有使用最新的开发分支,我建议您先尝试一下,因为 PR accepted after the 8.0 release 修复了此脚本输出中与字节与字符串相关的问题。我也不确定它们将如何交互,但您目前似乎激活了 2 个虚拟环境,这可能会干扰某些版本控制...因为它的 Python3.8 对于您的 Anaconda,我是对此表示怀疑,但值得考虑。