A tag for questions about accessing resources local to a given runtime environment or network.
Questions tagged [locals]
96 questions
0
votes
3 answers
Is there any way to affect locals at runtime?
I actually want to create a new local. I know it sounds dubious, but I think I have a nice use case for this. Essentially my problem is that this code throws "NameError: global name 'eggs' is not defined" when I try to print eggs:
def f():
…

ubershmekel
- 11,864
- 10
- 72
- 89
0
votes
1 answer
django passing locals() to celery task
I am using python 2.7 and django 1.27, i am using celery for tasks.
I have this view
def my_view(request):
do_stuff()
local_1 = 1
local_2 = 4
celery_delayed_task(locals())
return HttpResponse('OK')
this resulted in this…

yossi
- 12,945
- 28
- 84
- 110
0
votes
1 answer
How to get base properties and fields with values using reflection to work up the class hierarchy?
How can I get base class properties and fields using reflection, so that I can work UP the class hierarchy one level at a time? The goal is to build a tree display showing properties and fields with values of any class instance, just like the…

John_Sheares
- 1,404
- 2
- 21
- 34
0
votes
1 answer
Passing locals to partial
I'm trying to provide a form to create a "message" for each feature on the features_index page. Unfortunately I get the error "Couldn't find Feature without an ID."
Have I passed the locals in properly? Params does not appear to have a feature_id!…

Doug
- 293
- 1
- 2
- 10
-1
votes
1 answer
Express.js - Setting res.locals changes the req object
I am very confused what is about happening here. I am trying to set a res.locals default profile picture for a user if they do not currently have one. Here is my code:
// Make user object available in templates.
app.use(function(req, res, next) {
…

Beau
- 87
- 1
- 11
-2
votes
1 answer
Why does Python3 exec() raise an AttributeError when a variable is not in locals but is in gl
When I pass a bona fide dict for locals, exec() does the correct thing and falls back to the globals dictionary for missing names. However, if I pass a LazyMap (dict-like object) as locals, accesses to globals raise an AttributeError from inside…

saul
- 7
- 2