Skip to content

NameError when referencing defined globals in the debugger. #913

@justanr

Description

@justanr

Running werkzeug .10.4 wrapped around Django via Django-Extensions to use the Don't Panic! debugger in dev environments. Version of Python is 2.7.8.

I'm running into an issue where I can't access variables defined in the session from lambdas or functions defined in the debugger. Example:

import os
map(lambda x: os.path.basename(x.name), bucket.list())

Causes a NameError: global name 'os' is not defined. The same happens if I define an actual function.

import os
def get_key_basename(key): return os.path.basename(key.name)
map(get_key_basename, bucket.list())

Happens with pretty much any variable in the debugger's scope.

I see the the code being passed to Don't Panic through the dev server (?__debugger__=yes&cmd=...). I can't recall ever hitting this behavior and some quick searching only reveals that a NameError issue was fixed back in .6.1 (no details provided in the changelog).

We are running with reloading, but no reloading happens between starting the debugger and the NameError occurring.

If I've simply missed something, feel free to close this. Otherwise, I'm happy to provide my information as needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions