我现在一切正常,但我收到了错误。
控制台错误:
PS C:\Python\Artinis> python sort.py
Traceback (most recent call last):
File "sort.py", line 66, in <module>
if int(Config.get(section, 'name')) < sn_low:
ValueError: invalid literal for int() with base 10: '5DB7'
Python代码:
import ConfigParser
Config = ConfigParser.ConfigParser()
ConfigNew = ConfigParser.ConfigParser()
oxymon = []
portamon = []
portalite = []
follow = 0
index = 0
sn_low = 0
#Config.read("c:\\Python\\Artinis\\portasoft.ini")
Config.read("C:\\Users\\Public\\Documents\\Artinis Medical Systems BV\\common\\portasoft.ini")
for section in Config.sections():
if "Device" in section:
#print section
#print Config.items(section)
#print Config.options(section)
name = Config.get(section, 'name')
type = Config.get(section, 'type')
if "OXYMON" in type:
oxymon.append(section)
elif "PORTAMON" in type:
portamon.append(section)
elif "PORTALITE" in type:
portalite.append(section)
#Maakt een lijst van alles wat is niet "Device".
else:
ConfigNew.add_section(section)
for item in Config.items(section):
ConfigNew.set(section, item[0], item[1])
""""#Sorteer functies#"""
#Sorteert Oxymon op "name".
'''
for loop in oxymon:
index = 0
for section in oxymon:
if index == follow:
sn_low = int(Config.get(section, 'name'))
if index > follow:
if int(Config.get(section, 'name')) < sn_low:
sn_low = Config.get(section, 'name')
oxymon_temp = oxymon[index]
oxymon[index] = oxymon[follow]
oxymon[follow] = oxymon_temp
index = index + 1
follow = follow + 1
'''
#Sorteert Portamon op "name".
for loop in portamon:
index = 0
for section in portamon:
if index == follow:
sn_low = int(Config.get(section, 'name'))
if index > follow:
if int(Config.get(section, 'name')) < sn_low:
sn_low = Config.get(section, 'name')
portamon_temp = portamon[index]
portamon[index] = portamon[follow]
portamon[follow] = portamon_temp
index = index + 1
follow = follow + 1
#Sorteert Portalite op "name".
for loop in portalite:
index = 0
for section in portalite:
if index == follow:
sn_low = int(Config.get(section, 'name'))
if index > follow:
if int(Config.get(section, 'name')) < sn_low:
sn_low = Config.get(section, 'name')
portalite_temp = portalite[index]
portalite[index] = portalite[follow]
portalite[follow] = portalite_temp
index = index + 1
follow = follow + 1
"""#Functies om te printen#"""
index = 0
print ""
#Print Oxymon.
for section in oxymon:
ConfigNew.add_section('Device%r' % index)
for item in Config.items(section):
ConfigNew.set('Device%r' % index, item[0], item[1])
index = index + 1
print "> Oxymon"
print "> -%r" % section
print "> -%r" % Config.get(section, 'name')
#print Config.get(section, 'type')
print ""
#Print Portamon.
for section in portamon:
ConfigNew.add_section('Device%r' % index)
for item in Config.items(section):
ConfigNew.set('Device%r' % index, item[0], item[1])
index = index + 1
print "> Portamon"
print "> -%r" % section
print "> -%r" % Config.get(section, 'name')
#print Config.get(section, 'type')
print ""
#Print Portalite.
for section in portalite:
ConfigNew.add_section('Device%r' % index)
for item in Config.items(section):
ConfigNew.set('Device%r' % index, item[0], item[1])
index = index + 1
print "> Portalite"
print "> -%r" % section
print "> -%r" % Config.get(section, 'name')
#print Config.get(section, 'type')
print ""
"""#Functies om te schrijven#"""
#Alles voor "Device*" schrijven.
with open('portasoft_new.ini', 'wb') as configfile:
ConfigNew.write(configfile)
从此文件中排序。
[Admin]
ShowTools=1
ShowMeasurements=0
[Test]
Test=Test
[Session]
Name=06124
Location=C:\Users\Djordy\Desktop\Dump\
[Comms]
Port=COM140
[Asciiwriter]
Enable=1
[Device0]
Name=AnyOxymon
Type = OXYMON
Enabled=0
MessageLayer=ML_VOXY
CodingLayer=CL_HDLC
PhysicalLayer=PL_FTDI
PhysicalLayerPort=
PhysicalLayerParams=1250000,n,8,1,FLOW_RTS_CTS
[Device1]
Name = 203
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
;PhysicalLayer=PL_VIRTUALCOMM
;PhysicalLayerPort=COM43
;PhysicalLayerParams=115200,n,8,1
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A096134B20
PhysicalLayerParams=115200,n,8,1
[Device2]
Name = 207
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
Name = 207
PhysicalLayerPort=000666003BEC
PhysicalLayerParams=115200,n,8,1
[Device3]
Name = 209
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
;PhysicalLayer=PL_VIRTUALCOMM
;PhysicalLayerPort=COM20
;PhysicalLayerParams=115200,n,8,1
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=0006660039CB
PhysicalLayerParams=115200,n,8,1
[Device4]
Name = 210
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066600A620
PhysicalLayerParams=115200,n,8,1
[Device5]
Name = 211
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=0006660039DB
PhysicalLayerParams=115200,n,8,1
[Device6]
Name = 212
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066600A630
PhysicalLayerParams=115200,n,8,1
[Device7]
Name = 213
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A096134B11
PhysicalLayerParams=115200,n,8,1
[Device8]
Name = 214
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A096134B12
PhysicalLayerParams=115200,n,8,1
[Device9]
Name = 215
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A096134B09
PhysicalLayerParams=115200,n,8,1
[Device10]
Name = 218
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A096134B0F
PhysicalLayerParams=115200,n,8,1
[Device11]
Name = 219
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DC2
PhysicalLayerParams=115200,n,8,1
[Device12]
Name = 220
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DC6
PhysicalLayerParams=115200,n,8,1
[Device13]
Name = 221
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DD2
PhysicalLayerParams=115200,n,8,1
[Device14]
Name = 5DB7
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DB7
PhysicalLayerParams=115200,n,8,1
[Device15]
Name = 223
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666016574
PhysicalLayerParams=115200,n,8,1
[Device16]
Name = 224
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DD3
PhysicalLayerParams=115200,n,8,1
[Device17]
Name = 225
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DB6
PhysicalLayerParams=115200,n,8,1
[Device18]
Name = 226
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066601656F
PhysicalLayerParams=115200,n,8,1
[Device19]
Name = 227
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DE5
PhysicalLayerParams=115200,n,8,1
[Device20]
Name = 228
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DD6
PhysicalLayerParams=115200,n,8,1
[Device21]
Name = 229
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DD7
PhysicalLayerParams=115200,n,8,1
[Device22]
Name = 230
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066601656B
PhysicalLayerParams=115200,n,8,1
[Device23]
Name = 231
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DB4
PhysicalLayerParams=115200,n,8,1
[Device24]
Name = 232
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666015DC5
PhysicalLayerParams=115200,n,8,1
[Device25]
Name = 233
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666016570
PhysicalLayerParams=115200,n,8,1
[Device26]
Name = FEF1
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A09618FEF1
PhysicalLayerParams=115200,n,8,1
[Device27]
Name = A5FF
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066600A5FF
PhysicalLayerParams=115200,n,8,1
[Device28]
Name = 4B15
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A096134B15
PhysicalLayerParams=115200,n,8,1
[Device29]
Name = A610
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066600A610
PhysicalLayerParams=115200,n,8,1
[Device30]
Name = 3BEA
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=000666003BEA
PhysicalLayerParams=115200,n,8,1
[Device31]
Name=Portamon 200
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_UART
PhysicalLayerPort=COM2
PhysicalLayerParams=115200,n,8,1
[Device32]
Name=AdBox
Type = ADBOX
Enabled=0
MessageLayer=ML_VOXY
CodingLayer=CL_HDLC
PhysicalLayer=PL_FTDI
PhysicalLayerPort=
PhysicalLayerParams=1250000,n,8,1,FLOW_RTS_CTS
[Device33]
Name=VC820
Type=VC820
Enabled=0
MessageLayer=ML_VC820
CodingLayer=CL_TIMEDPACKET
CodingLayerParams=200, 14
PhysicalLayer=PL_UART
PhysicalLayerPort=COM2
PhysicalLayerParams=2400,n,8,1,FLOW_RTS_CONTROL_DISABLE + FLOW_DTR_CONTROL_ENABLE
[Device34]
Name=SignalGenerator
Type=SIGNALGENERATOR
Enabled=0
MessageLayer=ML_SIGNALGEN
CodingLayer=CL_DUMMY
PhysicalLayer=PL_DUMMY
PhysicalLayerPort=
PhysicalLayerParams=
[Device35]
Name=PortaProto_CCD
Type=PORTAMON
Enabled=0
MessageLayer=ML_PORTAPROTO
CodingLayer=CL_MAGIC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066600D68C
PhysicalLayerParams=115200,n,8,1
;PhysicalLayer=PL_VIRTUALCOMM
;PhysicalLayerPort=COM82
;PhysicalLayerParams=115200,n,8,1
[Device36]
;Name=Digiflow
;Type=SIGNALGENERATOR
;Enabled=0
;MessageLayer=ML_DIGIFLOW
;CodingLayer=CL_TIMEDPACKET
;CodingLayerParams=50,55
;PhysicalLayer=PL_FTDI
;PhysicalLayerPort=
;PhysicalLayerParams=250000,n,8,1
Name=AnyOxymon
Type = OXYMON
Enabled=0
MessageLayer=ML_VOXY
CodingLayer=CL_HDLC
PhysicalLayer=PL_FTDI
PhysicalLayerPort=
PhysicalLayerParams=1250000,n,8,1,FLOW_RTS_CTS
[Device37]
Name=AnyOxymon
Type = OXYMON
Enabled=0
MessageLayer=ML_VOXY
CodingLayer=CL_HDLC
PhysicalLayer=PL_FTDI
PhysicalLayerPort=
PhysicalLayerParams=1250000,n,8,1,FLOW_RTS_CTS
[Device38]
Name=AdBox_4103
Type = OXYMON
Enabled=0
MessageLayer=ML_VOXY
CodingLayer=CL_HDLC
PhysicalLayer=PL_FTDI
PhysicalLayerPort=AMS04103
PhysicalLayerParams=1250000,n,8,1,FLOW_RTS_CTS
[Device39]
Name=Oxymon_95
Type = OXYMON
Enabled=0
MessageLayer=ML_VOXY
CodingLayer=CL_HDLC
PhysicalLayer=PL_FTDI
PhysicalLayerPort=AMS095
PhysicalLayerParams=1250000,n,8,1,FLOW_RTS_CTS
[Device40]
Name = 201
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A096134B16
PhysicalLayerParams=115200,n,8,1
[Device41]
Name = 205
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
Name = 207
PhysicalLayerPort=00A096134B5A
PhysicalLayerParams=115200,n,8,1
[Device42]
Name=Oxymon_VoxyDirect
Type = OXYMON
Enabled=0
MessageLayer=ML_DUMMY
CodingLayer=CL_HDLC
PhysicalLayer=PL_FTDI
PhysicalLayerPort=
PhysicalLayerParams=1250000,n,8,1,FLOW_RTS_CTS
[Device43]
Name = 234
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_VIRTUALCOMM
PhysicalLayerPort=COM40
PhysicalLayerParams=115200,n,8,1
[Device44]
Name = 235
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_VIRTUALCOMM
PhysicalLayerPort=COM41
PhysicalLayerParams=115200,n,8,1
[Device45]
Name = 236
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D702
PhysicalLayerParams=115200,n,8,1
[Device46]
Name = 237
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D701
PhysicalLayerParams=115200,n,8,1
[Device47]
Name = 238
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D721
PhysicalLayerParams=115200,n,8,1
[Device48]
Name = 239
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=0006660A305B
PhysicalLayerParams=115200,n,8,1
[Device49]
Name = 240
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D714
PhysicalLayerParams=115200,n,8,1
[Device50]
Name = 241
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D722
PhysicalLayerParams=115200,n,8,1
[Device51]
Name = 242
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D6FD
PhysicalLayerParams=115200,n,8,1
[Device52]
Name = 243
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D703
PhysicalLayerParams=115200,n,8,1
[Device53]
Name = 244
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D6F3
PhysicalLayerParams=115200,n,8,1
[Device54]
Name = 245
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D712
PhysicalLayerParams=115200,n,8,1
[Device55]
Name = 246
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D711
PhysicalLayerParams=115200,n,8,1
[Device56]
Name = 247
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00066602D6F2
PhysicalLayerParams=115200,n,8,1
[Device57]
Name = 204
Type = PORTAMON
Enabled=0
MessageLayer=ML_IOCTL
CodingLayer=CL_HDLC
PhysicalLayer=PL_BTSOCKET
PhysicalLayerPort=00A096134B1C
PhysicalLayerParams=115200,n,8,1
[Device58]
Name = 249
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f201
PhysicalLayerParams=115200,n,8,1
[Device59]
Name = 250
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f211
PhysicalLayerParams=115200,n,8,1
[Device60]
Name = 251
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f212
PhysicalLayerParams=115200,n,8,1
[Device61]
Name = 252
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f233
PhysicalLayerParams=115200,n,8,1
[Device62]
Name = 253
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f232
PhysicalLayerParams=115200,n,8,1
[Device63]
Name = 254
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f22f
PhysicalLayerParams=115200,n,8,1
[Device64]
Name = 255
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort =00066602f221
PhysicalLayerParams=115200,n,8,1
[Device65]
Name = 256
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f202
PhysicalLayerParams=115200,n,8,1
[Device66]
Name = 257
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f230
PhysicalLayerParams=115200,n,8,1
[Device67]
Name = 258
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f20f
PhysicalLayerParams=115200,n,8,1
[Device68]
Name = 259
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f213
PhysicalLayerParams=115200,n,8,1
[Device69]
Name = 260
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f203
PhysicalLayerParams=115200,n,8,1
[Device70]
Name = 261
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f200
PhysicalLayerParams=115200,n,8,1
[Device71]
Name = 262
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f231
PhysicalLayerParams=115200,n,8,1
[Device72]
Name = 263
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f222
PhysicalLayerParams=115200,n,8,1
[Device73]
Name = 265
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort =00066602f220
PhysicalLayerParams=115200,n,8,1
[Device74]
Name = 266
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602f210
PhysicalLayerParams=115200,n,8,1
[Device75]
Name = 268
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607ACFA
PhysicalLayerParams=115200,n,8,1
[Device76]
Name = 269
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607ACFE
PhysicalLayerParams=115200,n,8,1
[Device77]
Name = 270
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607AD01
PhysicalLayerParams=115200,n,8,1
[Device78]
Name = 271
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607AD02
PhysicalLayerParams=115200,n,8,1
[Device79]
Name = 272
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607AD03
PhysicalLayerParams=115200,n,8,1
[Device80]
Name = 273
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607AD04
PhysicalLayerParams=115200,n,8,1
[Device81]
Name = 274
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607AD05
PhysicalLayerParams=115200,n,8,1
[Device82]
Name = 275
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607AD06
PhysicalLayerParams=115200,n,8,1
[Device83]
Name = 276
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607AD08
PhysicalLayerParams=115200,n,8,1
[Device84]
Name = 277
Type = PORTAMON
Enabled =0
MessageLayer = ML_IOCTL
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066607AD09
PhysicalLayerParams=115200,n,8,1
[Device85]
Name = WheightScale
Type = VC820
Enabled =0
MessageLayer = ML_WHEIGHTSCALE
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066604A6E5
PhysicalLayerParams=62500,n,8,1
[Device86]
Name = WheightScale
Type = VC820
Enabled =0
MessageLayer = ML_WHEIGHTSCALE
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066604A6E1
PhysicalLayerParams=62500,n,8,1
[Device87]
Name = WheightScale
Type = VC820
Enabled =0
MessageLayer = ML_WHEIGHTSCALE
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066604A6E3
PhysicalLayerParams=62500,n,8,1
[Device88]
Name = WheightScale
Type = VC820
Enabled =0
MessageLayer = ML_WHEIGHTSCALE
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 000666033f51
PhysicalLayerParams=62500,n,8,1
[Device89]
Name = WheightScale
Type = VC820
Enabled =0
MessageLayer = ML_WHEIGHTSCALE
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066602D704
PhysicalLayerParams=62500,n,8,1
[Device90]
Name = DummyDevice
Type = PORTAMON
Enabled =0
MessageLayer = ML_DUMMYDEVICE
CodingLayer = CL_DUMMY
PhysicalLayer = PL_DUMMY
PhysicalLayerPort = 00066604A6E2
PhysicalLayerParams=115200,n,8,1
[Device91]
Name = PortamonLpc
Type = PORTAMON
Enabled =0
MessageLayer = ML_FORMATDESCRIPTOR
CodingLayer = CL_HDLC
PhysicalLayer = PL_BTSOCKET
PhysicalLayerPort = 00066604A6E2
PhysicalLayerParams=115200,n,8,1
文件更长,但你可以理解。
一些&#34;姓名&#34;在文件中还包含章程而不仅仅是数字。 int()只对数字进行排序。
我该如何解决这个问题?
答案 0 :(得分:2)
5DB7
不是有效的十进制数。也许你的数字不是小数而是十六进制而是
如果是这样,请告诉int()
使用不同的基础:
int(Config.get(section, 'name'), 16)
如果您有姓名而不是转换为任何号码,则您必须明确处理这些案件。赶上转换:
try:
number = int(Config.get(section, 'name'), 16)
except ValueError:
# handle a name that doesn't convert, perhaps set a default
number = float('inf') # a number that's guaranteed to come last