From 36068c3d475384aa427646e54229ddfde7d14aaf Mon Sep 17 00:00:00 2001
From: jaseg <jaseg@jaseg.net>
Date: Sun, 12 Jan 2014 19:07:12 +0100
Subject: Import fixes and a small terminal size handling fix

---
 pixelterm/gifterm.py   | 10 +++++++---
 pixelterm/pixelterm.py |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

(limited to 'pixelterm')

diff --git a/pixelterm/gifterm.py b/pixelterm/gifterm.py
index 0ebded1..e3563f3 100755
--- a/pixelterm/gifterm.py
+++ b/pixelterm/gifterm.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 import os, sys, argparse, os.path, json, time, signal, atexit
-from pixelterm import pixelterm
+import pixelterm
 from PIL import Image, GifImagePlugin, ImageSequence
 
 clear_screen = '\033[H\033[2J'
@@ -18,7 +18,10 @@ def main():
 	if args.size:
 		tw, th = map(int, args.size.split('x'))
 	else:
-		tw, th = os.get_terminal_size()
+		try:
+			tw, th = os.get_terminal_size()
+		except: # If this is not a regular terminal
+			pass
 	th = th*2
 
 	img = Image.open(args.image)
@@ -38,7 +41,8 @@ def main():
 			last_frame = c
 
 		im = last_frame.copy()
-		im.thumbnail((tw, th), Image.NEAREST)
+		if (tw, th) != (None, None):
+			im.thumbnail((tw, th), Image.NEAREST)
 		frames.append(pixelterm.termify_pixels(im))
 
 	print(cursor_invisible)
diff --git a/pixelterm/pixelterm.py b/pixelterm/pixelterm.py
index dccd788..30af163 100755
--- a/pixelterm/pixelterm.py
+++ b/pixelterm/pixelterm.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-from pixelterm import xtermcolors
+import xtermcolors
 
 reset_sequence = '\033[39;49m'
 
-- 
cgit