Introduction
Introduction Statistics Contact Development Disclaimer Help
Fix Windows compatibility - toot - Unnamed repository; edit this file 'descript…
Log
Files
Refs
LICENSE
---
commit 007d5539fa50568a6c4f2cf8bfcabebf12cd0a11
parent 90976235358a52745331fd6b0d3546af8bf94996
Author: Ivan Habunek <[email protected]>
Date: Sat, 9 Sep 2017 09:54:13 +0200
Fix Windows compatibility
Don't load curses until required. Since it's not available on windows,
importing the module early broke the whole app.
issue #18
Diffstat:
toot/app.py | 8 +++++++-
toot/commands.py | 2 +-
toot/console.py | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/toot/app.py b/toot/app.py
@@ -2,13 +2,19 @@
from __future__ import unicode_literals
from __future__ import print_function
-import curses
import webbrowser
from textwrap import wrap
+from toot import ConsoleError
from toot.utils import format_content
+# Attempt to load curses, which is not available on windows
+try:
+ import curses
+except ImportError as e:
+ raise ConsoleError("Curses is not available on this platform")
+
class Color:
@staticmethod
diff --git a/toot/commands.py b/toot/commands.py
@@ -16,7 +16,6 @@ from textwrap import TextWrapper, wrap
from toot import api, config, DEFAULT_INSTANCE, User, App, ConsoleError
from toot.output import print_out
-from toot.app import TimelineApp
def register_app(instance):
@@ -177,6 +176,7 @@ def timeline(app, user, args):
def curses(app, user, args):
+ from toot.app import TimelineApp
generator = api.timeline_generator(app, user)
TimelineApp(generator).run()
diff --git a/toot/console.py b/toot/console.py
@@ -127,7 +127,7 @@ READ_COMMANDS = [
),
Command(
name="curses",
- description="An experimental timeline app.",
+ description="An experimental timeline app (doesn't work on Windows)",
arguments=[],
require_auth=True,
),
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.