devstructure / blueprint

Reverse engineer server configuration
http://devstructure.com/
Other
2.15k stars 132 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 8603: ordinal not in range(128) #151

Closed pocesar closed 6 years ago

pocesar commented 10 years ago
root@:/home/ubuntu/blueprint# blueprint show -S web
Traceback (most recent call last):
  File "/usr/local/bin/blueprint-show", line 73, in <module>
    filename = getattr(b, options.generate)(options.relaxed).dumpf()
  File "/usr/local/lib/python2.7/dist-packages/blueprint/frontend/sh.py", line 333, in dumpf
    f.write('{0}\n'.format(out))
  File "/usr/lib/python2.7/codecs.py", line 691, in write
    return self.writer.write(data)
  File "/usr/lib/python2.7/codecs.py", line 351, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 8603: ordinal not in range(128)

Cloned from repo master, Ubuntu 13.04 LTE x64. Couldn't find the source of this error. The other issues about the same thing did not happen at all, since I don't have any latin-1 folder names.

umito commented 10 years ago
 blueprint show -S my-blueprint
Traceback (most recent call last):
  File "/usr/local/bin/blueprint-show", line 63, in <module>
    filename = getattr(b, options.generate)(options.relaxed).dumpf()
  File "/usr/local/lib/python2.7/dist-packages/blueprint/frontend/sh.py", line 333, in dumpf
    f.write('{0}\n'.format(out))
  File "/usr/lib/python2.7/codecs.py", line 691, in write
    return self.writer.write(data)
  File "/usr/lib/python2.7/codecs.py", line 351, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 8256: ordinal not in range(128)

Installed using pip on Ubuntu 12.04.4 LTS x64.

bussiere commented 10 years ago

same here :: blueprint show -S my-first-blueprint Traceback (most recent call last): File "/usr/local/bin/blueprint-show", line 63, in filename = getattr(b, options.generate)(options.relaxed).dumpf() File "/usr/local/lib/python2.7/dist-packages/blueprint/frontend/sh.py", line 333, in dumpf f.write('{0}\n'.format(out)) File "/usr/lib/python2.7/codecs.py", line 688, in write return self.writer.write(data) File "/usr/lib/python2.7/codecs.py", line 351, in write data, consumed = self.encode(object, self.errors) UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 2984: ordinal not in range(128)

alasdaircr commented 10 years ago

This fixes it:

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

line 7 of blueprint-apply (and presumably blueprint-show too)

slava-vishnyakov commented 9 years ago

Still happens on Ubuntu 14.04 Editing /usr/local/bin/blueprint-show with recommendation from @alasdaircr helps!

binarytemple commented 8 years ago

+1 Is this project still alive - haven't seen any P/R merged for years now.

I added the following to blueprint/frontend/sh.py and was able to generate the shell manifest:

 18 import sys
 19 
 20 reload(sys)
 21 sys.setdefaultencoding('utf8')
kaitaotang commented 3 years ago

This fixes it:

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

line 7 of blueprint-apply (and presumably blueprint-show too)

I used your code, but the terminal shows "NameError: name 'reload' is not defined", why ?