Yes I **do**.
If I write the function on the default.py and run it via 
default/import_catalog it works.
On Sunday, March 23, 2014 7:34:20 PM UTC+2, Niphlod wrote:
>
> very very strange. 
> just for completeness sake, you **do** have models/db.py with
>
> db = DAL(.....)
>
> right ?
>
> On Saturday, March 22, 2014 8:49:11 PM UTC+1, Avi A wrote:
>>
>> Same.
>> /models/z_import_catalog.py", line 13, in <module>
>>     item = db(db.t_items.unfi_product == row[5]).select().first()
>> NameError: name 'db' is not defined
>>
>>
>>
>> On Saturday, March 22, 2014 9:20:03 PM UTC+2, Niphlod wrote:
>>>
>>> try calling it z_whatever.py and see. 
>>>
>>> On Saturday, March 22, 2014 3:34:48 PM UTC+1, Avi A wrote:
>>>>
>>>> Sorry, I'm still getting the same error.
>>>> I called that file:
>>>> db_wizard_catalog_insert.py , so it's located after the db_wizard.py 
>>>> and I just run the file.
>>>> Is that what you meant?
>>>>
>>>> On Saturday, March 22, 2014 4:05:03 PM UTC+2, Avi A wrote:
>>>>>
>>>>> Yes I tried that too, it didn't help. but now for some reason I'm not 
>>>>> getting the error any longer. Thanks.
>>>>>
>>>>> On Saturday, March 22, 2014 3:12:32 PM UTC+2, Niphlod wrote:
>>>>>>
>>>>>> make sure the model is run AFTER the one holding the db 
>>>>>> definition.........models are executed alphabetically.
>>>>>>
>>>>>> On Friday, March 21, 2014 9:28:14 PM UTC+1, Avi A wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>> I'm trying to create a background job/function. I'm locating the 
>>>>>>> file on the models directory, as I read on the book.
>>>>>>> When I try to run the script manually, I get an error saying that db 
>>>>>>> is not defined.
>>>>>>> This is part of the code where I get the error:
>>>>>>> ......
>>>>>>> ......
>>>>>>> catalog = csv.reader(webpage)
>>>>>>> for row in catalog:
>>>>>>>     item = db(db.t_items.unfi_product_== row[5]).select().first()
>>>>>>>     if row > 0 and not item:
>>>>>>>         ..........
>>>>>>>
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>>
>>>>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to