As I'm relatively new to the python ecosystem some things, which may be obvious for many, continue to bother me a bit. The last problem I encounter, which block me for several days, was the following.
In my spare time, I'm developing carp, a python3 application to help me manage my different encFS containers. As I want to do clean stuff and learn good practice, I check my source code with flake8. And I setup internationalization too.
import gettext gettext.install("carp", PATH_TO_PO_FILES)
This, is responsible to install the
_ function in the global
namespace. Problem is, if I do that, flake8 keeps complaining that
is undeclared. Thus, I stupidly redeclare it this way 2:
import gettext gettext.install("carp", PATH_TO_PO_FILES) _ = gettext.gettext
import gettext gettext.bindtextdomain("carp", PATH_TO_PO_FILES) gettext.textdomain("carp") _ = gettext.gettext
But still, I'm wondering why 2 does not work. Did I forget something? Surely, I misunderstood something, but I cannot point it out. Comments and explanations if you have some are very welcome.
(This post will be cross post to stackoverflow, I'll update it with an answer from there if any good one comes.)