Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.21k forks source link

Zappa crashes during zappa init #1388

Open cameronk opened 6 years ago

cameronk commented 6 years ago

Context

Zappa crashes when running zappa init, after the step where I name the bucket.

==============

Traceback (most recent call last):
  File "c:\users\camer\desktop\development\ryze\content-engine\api\env\lib\site-packages\zappa\cli.py", line 2610, in handle
    sys.exit(cli.handle())
  File "c:\users\camer\desktop\development\ryze\content-engine\api\env\lib\site-packages\zappa\cli.py", line 476, in handle
    self.init()
  File "c:\users\camer\desktop\development\ryze\content-engine\api\env\lib\site-packages\zappa\cli.py", line 1604, in init
    matches = detect_flask_apps()
  File "c:\users\camer\desktop\development\ryze\content-engine\api\env\lib\site-packages\zappa\utilities.py", line 143, in detect_flask_apps
    lines = f.readlines()
  File "c:\users\camer\desktop\development\ryze\content-engine\api\env\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 308: character maps to <undefined>

==============

Expected Behavior

zappa should initialize

Actual Behavior

it crashes

Steps to Reproduce

  1. create a virtual environment, install zappa
  2. run zappa init
  3. it breaks

Your Environment

rgov commented 6 years ago

Python 3 is expecting that a .py file is encoded in Windows-1252, probably the default for Windows 10, but it isn't.

Potential fix: this line should open the file in binary mode (rb)

duaneking commented 6 years ago

This is still a thing; currently blocked on my windows devbox from doing ANY zappa dev due to this.