Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'Magic' object has no attribute 'cookie' while using python-jira

I've run into this issue while using the jira library for python. Despite setting the appropriate parameters for basic auth, I get the following:

Exception ignored in: <bound method Magic.del of <magic.Magic object at 0x7f2a4e5ff128>> Traceback (most recent call last): File "/home/keckj/.local/lib/python3.6/site-packages/magic.py", line 129, in del if self.cookie and magic_close: AttributeError: 'Magic' object has no attribute 'cookie'

Here's a quick snippet:

from jira import JIRA

user = '[email protected]'
apikey = 'xxxxxxxxxxxxxxxxxxxxx'
jira_server = 'https://xxxxxxxxxx.jira.com'
options = {'server': jira_server}

jira = JIRA(options, basic_auth=(user,apikey))

issue = jira.issue("KEY-123")
issue_summary = issue.fields.summary
issue_description = issue.fields.description
print('JIRA ISSUE SUMMARY: %s' %str(issue_summary))
print('JIRA ISSUE DESCRIPTION: %s' %str(issue_description))

I've dug in a few directions via Google but been coming up short:

  • https://github.com/Linaro/jipdate/issues/30
  • https://github.com/ahupp/python-magic/issues/47
  • Python attributeError on __del__
  • https://github.com/ahupp/python-magic/pull/222
like image 387
Jack Keck Avatar asked Oct 05 '20 17:10

Jack Keck


Video Answer


1 Answers

I found the answer buried at bottom of https://github.com/ahupp/python-magic/pull/222:

Apparently python-jira expects the filemagic python package, which takes a flags parameter, but for some reason our environment had your python-magic package, which expects different parameters.

Direct link: https://github.com/ahupp/python-magic/pull/222#issuecomment-675354824

To resolve this, I ran pip install filemagic and voila, no further exceptions.

like image 81
Jack Keck Avatar answered Sep 18 '22 14:09

Jack Keck