-1

I have the code piece below and a function called parse_issuelinks

i keep getting TypeError: 'NoneType' object is not subscriptable when I call the function parse_issuelinks

parse_issuelinks(k['fields']['issuelinks']) + '\n'


def parse_issuelinks(issuelinks):
dependsOn = ''

for issue in issuelinks:
    if issue['type']['name'] == 'Dep' and issue['type']['outward'] == 'dep'
        if 'outwardIssue' in issue:
            dependsOn = dependsOn + ',' + issue['outwardIssue']['key']

return dependsOn
khelwood
  • 55,782
  • 14
  • 81
  • 108
  • The value you’re putting in as an argument is `None`. Since you are trying to loop through `None`, you are getting an error. You may want to check your `k` dictionary. – Jack Moody Jan 10 '19 at 23:44
  • You need to provide an [MCVE](https://stackoverflow.com/help/mcve). Handling errors is fundamental to Python programs and is actually used to control logic (Ask forgiveness, not permission). There is no advice we can give to your current question that you couldn't find in any tutorial on exception handling. – roganjosh Jan 11 '19 at 00:03
  • The basic step is to figure out why you get a `None` at that point. Without that knowledge you can't proceed further. – hpaulj Jan 11 '19 at 00:25

1 Answers1

1

The error you showed is raised whenever you attempt to call a method on a variable with the value None. None is an instance of NoneType, and therefore defines its own instance methods.

Confirm that no values in k are None during the program and run it again.

Pika Supports Ukraine
  • 3,612
  • 10
  • 26
  • 42