Coder Social home page Coder Social logo

Comments (8)

joerg-lehmann avatar joerg-lehmann commented on August 20, 2024 1

It seems that your locales are missing. Try adjusting the paths and then running the gettext.sh script in the top level directory of the repository. In a properly released version, the generated files are contained. When running directly from the repository, however, you need to do this translation by yourself.

from pytone.

joerg-lehmann avatar joerg-lehmann commented on August 20, 2024 1

Some notes on the previous comments.

  • gettext.sh and msgftm.sh are part of my pre-release scripts that I added for Stefan's convenience to the repository. They were actually never intended to be run by users.
  • gettext.translation() is not deprecated in Python 3.8, only one of its arguments.
  • Fallback=true is a reasonable solution if no locale corresponding to the locale settings is available. I am a bit surprised that this issue only pops up now, but maybe there was a change in the gettext module that I am not aware of.
  • Please open separate, specific issues for unrelated problems. Thanks!

from pytone.

wimstefan avatar wimstefan commented on August 20, 2024

Sorry for coming back to this but is there anybody out there who got PyTone working with python3?

from pytone.

wimstefan avatar wimstefan commented on August 20, 2024

That's good to know! I'm indeed running PyTone directly from the repository and had no idea that I have to create the locales myself ;-)
I've modified the paths in both scripts gettext.sh and msgfmt.sh and ran both scripts.
gettext.sh first ended with an error and I had to modify src/pytone.py to run it successfully. Not that I understand a thing about Python but the script ran afterwards ... ;-)
Here are the changes that I made:

  diff --git a/src/pytone.py b/src/pytone.py
  index 6462dbf..a380182 100755
  --- a/src/pytone.py
  +++ b/src/pytone.py
  @@ -138,7 +138,7 @@ try:
                   config.finishconfigsection(pluginconfig)
                   pluginconfig = pluginconfig()
               plugins.append((pluginmodule, pluginconfig))
  -            log.info(_("Plugin '%s' loaded" % name))
  +            log.info(_("Plugin '%s' loaded") % name)
           except Exception as e:
                log.error(_("Cannot load plugin '%s': %s") % (name, e))
                log.debug_traceback()

But I still get the same error message as above 🤔

from pytone.

altendky avatar altendky commented on August 20, 2024
diff --git a/gettext.sh b/gettext.sh
index 7cb9ca5..da1d38f 100755
--- a/gettext.sh
+++ b/gettext.sh
@@ -4,8 +4,10 @@ POTFILE=locale/PyTone.pot
 LOCALES="de it pl fr"
 
 # Adjust the following paths as necessary
-PYGETTEXTPATH=/Library/Frameworks/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/i18n
-GETTEXTPATH=/usr/local/opt/gettext/bin
+# PYGETTEXTPATH=/Library/Frameworks/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/i18n
+PYGETTEXTPATH=/home/altendky/.pyenv/source/3.8.0/Python-3.8.0/Tools/i18n
+# GETTEXTPATH=/usr/local/opt/gettext/bin
+GETTEXTPATH=/usr/bin
 
 $PYGETTEXTPATH/pygettext.py -o $POTFILE src/*.py src/services/*.py src/services/songdbs/*.py src/services/players/*.py
 for locale in $LOCALES; do
diff --git a/src/pytone.py b/src/pytone.py
index 6462dbf..4e044cc 100755
--- a/src/pytone.py
+++ b/src/pytone.py
@@ -38,7 +38,7 @@ import importlib, importlib.util
 
 import gettext
 locallocaledir = os.path.join(os.path.dirname(sys.argv[0]), "../locale")
-gettext.translation("PyTone", locallocaledir).install()
+gettext.translation("PyTone", locallocaledir, languages=['it']).install()
 
 ##############################################################################
 # locale initialization

Above patch to 7bb928f got past the error for me. My machine would be setup for English and I do not know my way around gettext. But, it seems to just be a matter of getting a default language set or somesuch.

Note that gettext.translate() was just deprecated with 3.8.
https://docs.python.org/3/library/gettext.html#gettext.translation

Looks like maybe fallback=True is what is wanted. I'll file a PR and reference this issue so others can easily try it out.

from pytone.

wimstefan avatar wimstefan commented on August 20, 2024

Adding fallback=True resolves indeed the problem with the gettext.translation error I've reported.

But a new problem arises: the bufferedao extension. If I keep it enabled in setup.py and run python3 ./setup.py build_ext -i I get a segfault running the application. The logfile for the segfault is attached below.

2019-11-26-segfault-with-bufferedao.log

from pytone.

altendky avatar altendky commented on August 20, 2024

Wow, I did read that deprecation much too quickly. Thank you for the correction. And yes, it is odd that fallback=True hasn't been needed before unless this has only been run with de/fr/it/pl locales and never en etc. I looked and a quick glance over the py2 docs for gettext.translation() at least showed the same option and default. But, I've never actually used gettext so I have no real knowledge in the area.

from pytone.

wimstefan avatar wimstefan commented on August 20, 2024

Oh I wasn't aware that those scripts where in place for me - thank you for that!

And sorry for mentioning the problem with the bufferedao extension. I wasn't sure indeed whether to place it in this issue (with the title "Error running with Python 3.6") or open another issue for it. I've changed the title for this issue to make it more specific and I will open another issue for the bufferedao extension.

Thank you so much guys for keeping this (for me so precious) app alive!!! :)

from pytone.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.