Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add try except around importing curses to support windows
  • Loading branch information
hardbyte committed Jan 7, 2019
commit 4d31c40d8391d882e418742d5f691b894f44a9ca
18 changes: 13 additions & 5 deletions can/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,26 @@
from __future__ import absolute_import, print_function

import argparse
import can
import curses
import os
import struct
import sys
import time

from curses.ascii import ESC as KEY_ESC, SP as KEY_SPACE
import logging
from typing import Dict, List, Tuple, Union

import can
from can import __version__

logger = logging.getLogger('can.serial')

try:
import curses
from curses.ascii import ESC as KEY_ESC, SP as KEY_SPACE
except ImportError:
# Probably on windows
logger.warning("You won't be able to use the viewer program without "
"curses installed!")
curses = None


class CanViewer:

Expand Down