Skip to content

[FIX] SyntaxError: name '_' is used prior to global declaration#7

Open
sla-subteno-it wants to merge 1 commit intoOCA:masterfrom
subteno-it:fix-global-declaration
Open

[FIX] SyntaxError: name '_' is used prior to global declaration#7
sla-subteno-it wants to merge 1 commit intoOCA:masterfrom
subteno-it:fix-global-declaration

Conversation

@sla-subteno-it
Copy link

Before fix, we have this error :
Traceback (most recent call last):
File "/Users/alnslang/.virtualenvs/tests/bin/odoo-sentinel", line 7, in
from odoosentinel import main
File "/Users/alnslang/.virtualenvs/tests/lib/python3.6/site-packages/odoosentinel/init.py", line 87
global _
^
SyntaxError: name '_' is used prior to global declaration

# Replace global dummy lambda by the translations gettext method
# The install method of gettext doesn't replace the function if exists
global _
_ = language.gettext

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should move this line too, because the translation method is called on line 67.

@sla-subteno-it
Copy link
Author

@sylvain-garancher is-it ok ?

@Garamotte
Copy link

No, because there is a recursive depdency issue...

I think that we can simply make the Profile not found error message not translateable, as translations need the connection to be established, and this error message is displayed only when the connection could no be established.

@fmdl
Copy link
Contributor

fmdl commented Jul 15, 2018

sylvain cela fait 5 heures que on essaye de résoudre:

    from odoosentinel import main
  File "/Users/florentdelabarre/.virtualenvs/bobbies/lib/python3.6/site-packages/odoosentinel/__init__.py", line 87
    global _
    ^
SyntaxError: name '_' is used prior to global declaration

on comprend rien pour faire marcher ce truc. il y a pas de tuto. un peu pas travailler comme cela. c'est de développer des logiciels, c'est encore mieux quand les autres peuvent s'en servir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants