List index out of range when using strip

117 views Asked by At

I'm trying to use a script that downloads cydia repos and create a .json file but I'm getting this error.

error

I'm quite confused but here's the script that is causing it.


  with open(f'{filepath}') as csvfile:
      data = csv.reader(csvfile, delimiter=':')
      for line in data:
          if len(line) == 0:
              final_data['app'].append(app)
              app = {}
              continue

          if line[1].strip() in ['http', 'https']:
              line[1] = line[1] + ':' + line[2]  
        
          app[line[0]] = line[1].strip()

CSV FILE:


Name: LittleX
Package: com.ioscreatix.littlex
Description: iPhone X features for Non-X devices on iOS 11, and iPad Dock and PiP for All iOS 11 Devices on iOS 11
Architecture: iphoneos-arm
Section: Tweaks
Depiction: https://repo.packix.com/package/com.ioscreatix.littlex/
Icon: https://repo.packix.com/api/Packages/5a9598f992d82c1c7fa8fe59/icon/download?size=medium&hash=2
SileoDepiction: https://repo.packix.com/api/sileo/package/com.ioscreatix.littlex/depiction
Version: 1.3.7
Tag: purpose::extension, compatible_min::ios11.0, compatible_max::ios11.3.1
Filename: https://repo.packix.com/api/PackageVersions/5aa7f53361b6274040a7d0ca.deb
Size: 27538
MD5sum: 3917bb4029d1d82405ade779897a9172
SHA1: 8702ac2ca580e4305a3814c0ba13f30698d96834
SHA256: d8cf58010c438ac87a5d8b2c58f997684dd9204245089957c446aadc8f5c609b
Author: iOS Creatix
Maintainer: iOS Creatix
Depends: mobilesubstrate, preferenceloader
Installed-Size: 236

I printed out line before the error occurred and got this:

this error

If you need any extra info, just ask. Thanks in advance!

0

There are 0 answers