PyYaml not working

185 views
Skip to first unread message

Carlo Lozzovina

unread,
May 8, 2009, 5:50:06 PM5/8/09
to PyIns...@googlegroups.com
Hi guys, I have a problem when trying to make an exe with PyInstaller
that uses PyYaml. Here is the code:


-------
import yaml

def main():
print yaml.load(open('in.yaml').read())

if __name__ == '__main__':
main()
-------

When trying to run I get this:

c:\PyInstaller\fyaml\dist\fyaml>fyaml.exe
Traceback (most recent call last):
File "<string>", line 13, in <module>
File "<string>", line 8, in main
File "fyaml\build\pyi.win32\fyaml\outPYZ1.pyz/yaml", line 58, in load
File "fyaml\build\pyi.win32\fyaml\outPYZ1.pyz/yaml.constructor",
line 44, in get_single_data
File "fyaml\build\pyi.win32\fyaml\outPYZ1.pyz/yaml.constructor",
line 53, in construct_document
File "fyaml\build\pyi.win32\fyaml\outPYZ1.pyz/yaml.constructor",
line 403, in construct_yaml_map
File "fyaml\build\pyi.win32\fyaml\outPYZ1.pyz/yaml.constructor",
line 213, in construct_mapping
File "fyaml\build\pyi.win32\fyaml\outPYZ1.pyz/yaml.constructor",
line 132, in construct_mapping
File "fyaml\build\pyi.win32\fyaml\outPYZ1.pyz/yaml.constructor",
line 93, in construct_object
File "fyaml\build\pyi.win32\fyaml\outPYZ1.pyz/yaml.constructor",
line 391, in construct_yaml_str
LookupError: unknown encoding: ascii

Any ideas how to fix this? I didn't use "--ascii" option, if that matters.

Thanks in advance.

Carlo Lozzovina

unread,
May 8, 2009, 6:18:38 PM5/8/09
to PyInstaller
On May 8, 11:50 pm, Carlo Lozzovina <clozz...@gmail.com> wrote:

> Hi guys, I have a problem when trying to make an exe with PyInstaller
> that uses PyYaml. Here is the code:

Same thing happens even without Yaml, the simplest possible example:

------
def main():
a = "yaddayadda"
print a.encode("ascii")

if __name__ == '__main__':
main()
------

I tried adding all kinds of encodings.* imports, but nothing seems to
work.

Any help greatly appreciated.

Giovanni Bajo

unread,
May 12, 2009, 8:38:28 AM5/12/09
to PyIns...@googlegroups.com
On 5/9/2009 12:18 AM, Carlo Lozzovina wrote:
> On May 8, 11:50 pm, Carlo Lozzovina <clozz...@gmail.com> wrote:
>
>> Hi guys, I have a problem when trying to make an exe with PyInstaller
>> that uses PyYaml. Here is the code:
>
> Same thing happens even without Yaml, the simplest possible example:
>
> ------
> def main():
> a = "yaddayadda"
> print a.encode("ascii")
>
> if __name__ == '__main__':
> main()
> ------

This works with Python 2.5 and PyInstaller SVN trunk, on Windows. Which
versions are you using?
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com

Carlo Lozzovina

unread,
May 14, 2009, 11:53:02 AM5/14/09
to PyInstaller
On May 12, 2:38 pm, Giovanni Bajo <ra...@develer.com> wrote:

> This works with Python 2.5 and PyInstaller SVN trunk, on Windows. Which
> versions are you using?

My bad, I didn't check the requirements page for PyInstaller. Any
ideas when you might support Python 2.6?

Giovanni Bajo

unread,
May 18, 2009, 8:46:14 AM5/18/09
to PyIns...@googlegroups.com

There are some patches attached to ticket #39, if you want to test them.

They don't solve the encoding problem you're seeing, though.

Reply all
Reply to author
Forward
0 new messages