-1

So I'm working with jira using their module, trying to execute issue transitions and sometimes I get this error. It happens when there are more than 2 issues in a queue (and works fine when there is one in queue) My code is:

def task2(self):
    while True:
        project.task1(self)
        time.sleep(20)

def task1(self):
    user = **
    pass = **
    jira_url = "jira.example.com"
    
    try:
       jira_options = ('server': JIRA_URL)
       jql_string = jira.search_issue("project = AB")
       logging.basicConfig(filename='log-file.log', filemode = '+a', level=DEBUG)
       for is_num in jql_string:
           issue_num = jira.issue(is_num)
           summ = issue.summary
           descr = issue.description
        //some other code that has nothing to do with jira//
           jira.add_comment(issue_num, "Добавить комментарий")
           jira.transition_issue(issue_num, "1", fields={'customfield_1':'text1', 'customfield_2':'text2'})
           print('well done')
       jira.close()
    time.sleep(5)
    except TypeError as te:
           jira.add_comment(issue_num, "Добавить комментарий")
           jira.transition_issue(issue_num, "1", fields={'customfield_1':'text1', 'customfield_2':'text2'})
    except Exception as exc: #for connection time out
           pass

What can be the problem? It happens on second issue in a queue. Without transitions it works perfectly (some other code)

And it's not crashing even when there is only print('smth') in except Exception, traceback not logging neither with Error nor debug level

In debug log only 201 and 204 status responses

Added log. I'm trying to add comments in russian, and even though the error - it still adds commentary to request. IDK... Guess some encoding error. Error:

File "C:\script\task-jira.py", line 231 in add_comm
jira.add_comment(issue, 'xc07 xE0 xFF xE2')

Then errors in client.py in wrapper and add_comment. In add_comment

r = self._session.post(AttributeError: 'NoneType' object has no attribute 'post'
  • 3
    Show us the full error traceback and all code needed to reproduce the problem! – Klaus D. Apr 29 '21 at 11:55
  • Added code to question – Tomas Torquemada Apr 29 '21 at 14:36
  • And what is the exact error on what line? Pls post the full error traceback as requested while ago. – CraZ Apr 29 '21 at 21:18
  • Well,here's a problem,it's just don't crash.I mean, even when in exception was only print('smth'),the function to exception on comment or transition - it just printed smth, then went back and added commentary again (probably tried to transition too, but id of transitions changed).And when except Exception as error, then "error" writing to file it only wrote "'NoneType' object has no attribute 'post'".And for that time I cant reproduce the problem, cause decided to stop executing the code. – Tomas Torquemada Apr 30 '21 at 14:35
  • And finally-without add_comment and transitions - everything works just perfect.Probably,some sort of network issues, I guess, with post requests and stuff – Tomas Torquemada Apr 30 '21 at 14:35
  • You silenced the exception, that's never helpful when debugging. – Klaus D. May 01 '21 at 03:22
  • So. Turned off the exception. So I'm adding comments in cyrillic and as I see, the code tries to add some sh... and exception/error raises - but commentary adds to request – Tomas Torquemada May 04 '21 at 17:25

1 Answers1

0

FIgured it out. The problem was in commentary text.