Attualmente sto lavorando ad uno script Python che aggiorna una pagina web. Ma l'esecuzione dello script principale genera questo errore:AttributeError: L'oggetto 'NoneType' non ha attributo 'endswith'
<res status='-1'><error message="'NoneType' object has no attribute 'endswith'"><![CDATA[
Traceback (most recent call last):
File "/path/to/file/ws_config.py", line XXXX, in Run
tests = TestList().tests
File "/path/to/file/ws_config.py", line XXXX, in __init__
UpdateTestGroup(None),
File "/path/to/file/ws_config.py", line XXXX, in __init__
test = CT.CurlTest(settings),
File "/path/to/file/config_tests.py", line XXXX, in __init__
self.params.path = os.path.join('/', os.path.join(params.dir, params.file))
File "/usr/lib/python2.6/posixpath.py", line 67, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
Non riesco a superare alcun codice perché è troppo lungo. Quello che sto cercando di capire è dove si trova l'errore o quale parte del codice sta attivando l'AttributeError. Potete aiutarmi per favore ???
Il problema è nell'ultima ma una voce: "params.dir" o "params.file" è "None", non l'ultima voce poiché punta al modulo stdlib "posixpath.py'. –
Sì, hai ragione. Io editerò – zhangyangyu
Quindi stai praticamente dicendo che "params.dir" o "params.file" stanno restituendo un "None"? –