8000 variable scope problems in function definition · Issue #687 · jupyter-server/enterprise_gateway · GitHub
[go: up one dir, main page]

Skip to content
variable scope problems in function definition #687
@seegy

Description

@seegy

Hi there,

I'm using enterprise gateway on our kubernetes cluster (following this instructions).

Using a python notebook (in my case the kernel is elyra/kernel-spark-py:dev) I found the problem, that I cannot use variables inside a function definition, which are defined outside.

Example:

a = 123

def fun():
    print(a)
    
fun()

ends in:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/usr/local/bin/kernel-launchers/python/scripts/launch_ipykernel.py in <module>
     4     print(a)
     5
----> 6 fun()

/usr/local/bin/kernel-launchers/python/scripts/launch_ipykernel.py in fun()
     2
     3 def fun():
----> 4     print(a)
     5
     6 fun()

NameError: name 'a' is not defined

Same with import...

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0