Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI doesn't accept strings as typed, and does not cast input as integer when needed #3

Open
heisian opened this issue May 26, 2017 · 0 comments

Comments

@heisian
Copy link

heisian commented May 26, 2017

First no-no:

python /Library/Python/2.7/site-packages/imgscii/
__init__.py   __init__.pyc  imgscii.py    imgscii.pyc   
STRIPPER:ascii tim$ python /Library/Python/2.7/site-packages/imgscii/
__init__.py   __init__.pyc  imgscii.py    imgscii.pyc   
STRIPPER:ascii tim$ python /Library/Python/2.7/site-packages/imgscii/
__init__.py   __init__.pyc  imgscii.py    imgscii.pyc   
STRIPPER:ascii tim$ python /Library/Python/2.7/site-packages/imgscii/imgscii.py
What is the name of the image?
~/Desktop/berd.png
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 252, in <module>
    main()
  File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 35, in main
    file_name = input("What is the name of the image?\n")
  File "<string>", line 1
    ~/Desktop/berd.png
     ^
SyntaxError: invalid syntax

OK, so I need to put quotes around my image name. Not that bad, but now...

python /Library/Python/2.7/site-packages/imgscii/imgscii.py
What is the name of the image?
"/Users/tim/Desktop/berd.png"
How many columns do you want your ASCII art to be?
40
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 252, in <module>
    main()
  File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 60, in main
    printscii(file_name, monochrome=args.monochrome, columns=columns)
  File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 242, in printscii
    image = resize_image(image, width)
  File "/Library/Python/2.7/site-packages/imgscii/imgscii.py", line 98, in resize_image
    return img.resize((round(new_width), round(new_height)))
  File "/Library/Python/2.7/site-packages/PIL/Image.py", line 1645, in resize
    return self._new(self.im.resize(size, resample))
TypeError: integer argument expected, got float

I enter an integer and it thinks it's a float? Looks like you need to do some casting... int(input).

I also tried typing int(40) and no dice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant