0

I have a script:

    if (enviar_ftp(mounted_usb) >= 0):  # ML: enviar_ftp()->enviar_ftp(ser)
        # Se agrega la captura de schedule online
        s = get_schedule_online(get_id())
        log("Programa en servidor: {0}".format(s))
        if (s != ""):
            save_programa(s)
        enviar_situacion(get_id(), get_programa(), get_free_space()[3], 0, 0, str(100-int(get_free_space()[4])), battery_status(voltaje), voltaje, 0, 0)
        # ser_write("<txt>\n")
    else:
        log('enviar_ftp() failed')  # ser_write("<txn>\n")

Works fine in python2 but in python3 I get:

Traceback (most recent call last):
  File "/home/pi/main.py", line 511, in <module>
    app_main()
  File "/home/pi/main.py", line 499, in app_main
    send_pics()
  File "/home/pi/main.py", line 241, in send_pics
    enviar_situacion(get_id(), get_programa(), get_free_space()[3], 0, 0, str(100-int(get_free_space()[4])), battery_status(voltaje), voltaje, 0, 0)
TypeError: 'NoneType' object is not subscriptable

Any ideas?

Expect the script to work!!

  • Error is pretty clear. `NoneType` isn't going to be useful here, so track down where that came from. – tadman Feb 16 '23 at 02:04
  • 3
    Evidently, `get_free_space()` is returning `None`. – Kevin Feb 16 '23 at 02:10
  • Not an exact duplicate, but same basic problem: https://stackoverflow.com/questions/8949252/why-do-i-get-attributeerror-nonetype-object-has-no-attribute-something . – Ture Pålsson Feb 16 '23 at 05:57

0 Answers0