Giter VIP home page Giter VIP logo

Comments (3)

mattpoel avatar mattpoel commented on July 19, 2024

I also encountered some Unicode issues when using Python 2.7:

# ./toggl.py 
Traceback (most recent call last):
  File "/opt/initso/togglsync/toggl-cli-master/toggl.py", line 1265, in <module>
    CLI().act()
  File "/opt/initso/togglsync/toggl-cli-master/toggl.py", line 1039, in act
    Logger.info(TimeEntryList())
  File "/opt/initso/togglsync/toggl-cli-master/toggl.py", line 294, in info
    print("%s%s" % (msg, end)),
  File "/opt/initso/togglsync/toggl-cli-master/toggl.py", line 881, in __str__
    s += str(entry) + "\n"
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 31: ordinal not in range(128)

Using Python 3.5.1 solved it for me.

from toggl-cli.

Olen avatar Olen commented on July 19, 2024

Have the same issue.

Made a small patch to change a few str() to unicode() etc.

diff --git a/toggl.py b/toggl.py
old mode 100644
new mode 100755
index 6aff029..2af28b6
--- a/toggl.py
+++ b/toggl.py
@@ -878,7 +878,8 @@ class TimeEntryList(object):
             s += date + "\n"
             duration = 0
             for entry in days[date]:
-                s += str(entry) + "\n"
+                # s += str(entry) + "\n"
+                s += unicode(entry) + "\n"
                 duration += entry.normalized_duration()
             s += "  (%s)\n" % DateAndTime().elapsed_time(int(duration))
         return s.rstrip() # strip trailing \n
@@ -1062,7 +1063,8 @@ class CLI(object):

     def _show_projects(self, args):
         workspace_name = self._get_workspace_arg(args, optional=True)
-        print(ProjectList(workspace_name))
+        # print(ProjectList(workspace_name))
+        print(unicode(ProjectList(workspace_name)))

     def _continue_entry(self, args):
         """
@@ -1206,7 +1208,8 @@ class CLI(object):
         entry = TimeEntryList().now()

         if entry != None:
-            Logger.info(str(entry))
+            # Logger.info(str(entry))
+            Logger.info(unicode(entry))
         else:
             Logger.info("You're not working on anything right now.")


from toggl-cli.

AuHau avatar AuHau commented on July 19, 2024

This should be now fixed with the new version of Toggl CLI.

from toggl-cli.

Related Issues (20)

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.