pycontribs / jira

Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
https://jira.readthedocs.io
BSD 2-Clause "Simplified" License
1.95k stars 864 forks source link

Jira is not defined #1760

Open Oscaner opened 10 months ago

Oscaner commented 10 months ago

Bug summary

Run py script in jirashell, it's show Exception: jira is not defined, but when I use globals().update(locals()) to merge locals variables into globals, the jira client go on. May it's a bug or not?

image

Is there an existing issue for this?

Jira Instance type

Jira Cloud (Hosted by Atlassian)

Jira instance version

No response

jira-python version

3.5.2

Python Interpreter version

3.11.6

Which operating systems have you used?

Reproduction steps

1. Prepare a python file `jira_export.py`, and contain `print(jira.issue)` code.
2. Run jirashell into
3. Run `with open('jira_export.py') as f: exec(f.read())`
4. Show error `Exception: jira is not defined`
5. Run `globals().update(locals())`
6. Print the jira.issue object

Stack trace

In [4]: with open('jira_export.py') as f: exec(f.read())
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[4], line 1
----> 1 with open('jira_export.py') as f: exec(f.read())

File <string>:13

Exception: jira is not defined

In [5]: globals().update(locals())

In [6]: with open('jira_export.py') as f: exec(f.read())
issues: 0

Expected behaviour

Not throw exception.

Additional Context

No response

adehad commented 9 months ago

If you could provide an example of the python file that might be easier for someone to have a look.

I haven't used the jirashell interface myself but perhaps someone else might be able to spot anything unusual in either the file or our code.