Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to solve this error from raise Warning: NameError: global name '_' is not defined

By
Tatorus
on 3/8/16, 3:29 AM 1,273 views

Hi, when i click on a button to check the FTP connection, I've this error :

File "/usr/local/lib/python2.7/dist-packages/odoo-9.0c-py2.7.egg/openerp/addons/BHC_Copaco/copaco_config.py", line 78, in check_ftp

raise Warning(_('Username/password FTP connection was not successfully!'))

NameError: global name '_' is not defined

The problem comes from this line :

raise Warning(_('Username/password FTP connection was not successfully!'))

But it's strange because i use the same line in an other module and it worked.

Thanks in advance.

1
CatsandDogs
On 3/8/16, 4:34 AM

Add below line in import section,

Odoo 8

from openerp.tools.translate import _


Odoo 9

from openerp import api, fields, models, _


Done but same error :/

Tatorus
on 3/8/16, 5:00 AM

Ah no, not name error: now I've this : File "/usr/local/lib/python2.7/dist-packages/odoo-9.0c-py2.7.egg/openerp/addons/BHC_Copaco/copaco_config.py", line 79, in check_ftp raise Warning(_('Username/password FTP connection was not successfully!')) Warning: Username/password FTP connection was not successfully!

Tatorus
on 3/8/16, 5:01 AM

I think, it is a warning from your code. That have stopped your process and gives the error in terminal.

CatsandDogs
on 3/8/16, 5:20 AM

No need to worry about this

CatsandDogs
on 3/8/16, 5:20 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/8/16, 3:29 AM
Seen: 1273 times
Last updated: 3/8/16, 5:52 AM