泡菜和py2exe [英] pickle and py2exe

查看:60
本文介绍了泡菜和py2exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我试图用py2exe编译脚本。 pickle模块导致

程序出错。


Traceback(最近一次调用最后一次):

文件& ; SETIstat.pyw",第330行,在?

文件" SETIstat.pyw",第84行,在start_up

文件SETIstat.pyw,第79行,在config_load

文件" pickle.pyc",第1390行,在加载

文件" pickle.pyc",第872行,在加载

文件" pickle.pyc",第985行,在load_string中

LookupError:未知编码:string-escape


pickled文件中的数据是一个包含几个字符串的字典。

字符串包含\ n和\t字符,但没有其他特殊字符或

任何东西。


有没有人有什么建议我可以尝试解决这个问题?

pickle模块在运行.pyw文件时工作正常。只有当我编译这个

时才会出现问题。


感谢您的帮助,


Justin

解决方案

我做了一段时间,我不记得了。因此,我可能只会给你一个正确的方向,直到别人可以完全回答它。


但是,我认为你必须强制db进入py2exe编译。我认为

它是这样的:


--force-imports dbhash


试一试看看它是否有效。

" Justin Straube" <菊*********** @ charter.net>在消息中写道

news:qp ******************************** @ 4ax.com ...

你好,

我试图用py2exe编译脚本。 pickle模块导致
程序出错。

Traceback(最近一次调用最后一次):
文件SETIstat.pyw,第330行,在文件SETIstat.pyw,第84行,在start_up
文件SETIstat.pyw,第79行,在config_load
文件pickle.pyc中,行1390,在加载
文件pickle.pyc,第872行,在加载
文件" pickle.pyc",第985行,在load_string中
LookupError:未知编码:string-escape

pickle文件中的数据是一个包含几个字符串的字典。

字符串包含\ n和\t字符,但没有其他特殊字符或
有没有人对我可以尝试解决这个问题有任何建议?运行.pyw文件时,
pickle模块工作正常。只有当我编译这个
时才会出现问题。

感谢您的帮助,

Justin



>我试图用py2exe编译脚本。 pickle模块导致

程序出错。

Traceback(最近一次调用最后一次):
文件SETIstat.pyw,第330行,在文件SETIstat.pyw,第84行,在start_up
文件SETIstat.pyw,第79行,在config_load
文件pickle.pyc中,行1390,在加载
文件pickle.pyc,第872行,在加载
文件" pickle.pyc",第985行,在load_string中
LookupError:未知编码:string-escape

pickled文件中的数据是包含几个字符串的字典。
字符串确实包含\ n和\t字符,但没有其他特殊字符或
任何东西。

有没有人对我可以尝试解决这个问题有任何建议?运行.pyw文件时,
pickle模块工作正常。它只有在我编译时才会出现问题。

感谢您的帮助,

Justin




你在setup.py中包含了字符串转义编码吗?

我的猜测是你可以解决类似的问题:


from distutils.core import setup

import py2exe

opts = {" py2exe":{" packages":[" encodings"],}}

setup(windows = [" spam.py"],options = opts)

你的setup.py中的



希望它有所帮助

/ Johan Lindberg


2004年11月30日星期二22:48:39 -0600,鲶鱼 < losnations @ comca>写道:

我做了一段时间,我不记得了。因此,我可能只能向你推进正确的方向,直到其他人能够完全回答它为止。

然而,我认为你必须强迫数据库进入py2exe编译。我认为
它是这样的:

--force-imports dbhash

尝试这个,看它是否有效。


感谢Catfish,


这会产生错误,选项: - force-import无法识别。

在研究这篇文章的过程中,我看到了一些关于pickle中协议选项的提及。我没有为协议指定任何东西,所以它默认为0虽然我不知道

这是什么。这是我第一次使用pickle和第二次使用py2exe。


感谢您的建议,我会继续尝试这个和另一个没有

pickle的想法。


Justin

" Justin Straube" < justinstraube @ CH>在消息中写道
新闻:qp ******************************** @ 4ax.com ..。< blockquote class =post_quotes>你好,

我试图用py2exe编译脚本。 pickle模块导致
程序出错。

Traceback(最近一次调用最后一次):
文件SETIstat.pyw,第330行,在文件SETIstat.pyw,第84行,在start_up
文件SETIstat.pyw,第79行,在config_load
文件pickle.pyc中,行1390,在加载
文件pickle.pyc,第872行,在加载
文件" pickle.pyc",第985行,在load_string中
LookupError:未知编码:string-escape

pickle文件中的数据是一个包含几个字符串的字典。

字符串包含\ n和\t字符,但没有其他特殊字符或
有没有人对我可以尝试解决这个问题有任何建议?运行.pyw文件时,
pickle模块工作正常。只有当我编译这个
时才会出现问题。

感谢您的帮助,

Justin




Hello,

Im trying to compile a script with py2exe. The pickle module is causing the
program to give an error.

Traceback (most recent call last):
File "SETIstat.pyw", line 330, in ?
File "SETIstat.pyw", line 84, in start_up
File "SETIstat.pyw", line 79, in config_load
File "pickle.pyc", line 1390, in load
File "pickle.pyc", line 872, in load
File "pickle.pyc", line 985, in load_string
LookupError: unknown encoding: string-escape

the data in the pickled file is a dictionary containing a couple strings. The
strings do contain \n and \t charaters but no other special characters or
anything.

Does anyone have any suggestions to what I can try to get around this? The
pickle module works fine when the .pyw file is run. Its only when I compile this
is there an issue.

Thanks for any help,

Justin

解决方案

I did this a while back, and I can''t remember exactly. Therefore, I may only
be able to give you a push in the right direction until someone else can
answer it fully.

However, I think you have to force the db into the py2exe compile. I think
it''s something like this:

--force-imports dbhash

Try this and see if it works.
"Justin Straube" <ju***********@charter.net> wrote in message
news:qp********************************@4ax.com...

Hello,

Im trying to compile a script with py2exe. The pickle module is causing
the
program to give an error.

Traceback (most recent call last):
File "SETIstat.pyw", line 330, in ?
File "SETIstat.pyw", line 84, in start_up
File "SETIstat.pyw", line 79, in config_load
File "pickle.pyc", line 1390, in load
File "pickle.pyc", line 872, in load
File "pickle.pyc", line 985, in load_string
LookupError: unknown encoding: string-escape

the data in the pickled file is a dictionary containing a couple strings.
The
strings do contain \n and \t charaters but no other special characters or
anything.

Does anyone have any suggestions to what I can try to get around this? The
pickle module works fine when the .pyw file is run. Its only when I
compile this
is there an issue.

Thanks for any help,

Justin



> Im trying to compile a script with py2exe. The pickle module is causing the

program to give an error.

Traceback (most recent call last):
File "SETIstat.pyw", line 330, in ?
File "SETIstat.pyw", line 84, in start_up
File "SETIstat.pyw", line 79, in config_load
File "pickle.pyc", line 1390, in load
File "pickle.pyc", line 872, in load
File "pickle.pyc", line 985, in load_string
LookupError: unknown encoding: string-escape

the data in the pickled file is a dictionary containing a couple strings. The
strings do contain \n and \t charaters but no other special characters or
anything.

Does anyone have any suggestions to what I can try to get around this? The
pickle module works fine when the .pyw file is run. Its only when I compile
this is there an issue.

Thanks for any help,

Justin



Have you included string-escape encoding in your setup.py?
My guess is that you can fix the problem with something similar to:

from distutils.core import setup
import py2exe
opts = { "py2exe": { "packages": ["encodings"], } }
setup(windows= ["spam.py"], options= opts)

in your setup.py.

Hope it helps
/Johan Lindberg


On Tue, 30 Nov 2004 22:48:39 -0600, "Catfish" <losnations@comca> wrote:

I did this a while back, and I can''t remember exactly. Therefore, I may only
be able to give you a push in the right direction until someone else can
answer it fully.

However, I think you have to force the db into the py2exe compile. I think
it''s something like this:

--force-imports dbhash

Try this and see if it works.
Thanks Catfish,

This brought up an error, option: --force-import not recognized.

While looking into this, I had seen some mention of protocol option in pickle. I
hadnt specified anything for protocol, so it defaults to 0 though I dont know
what that is. Its my first time using pickle and second with py2exe.

Thanks for the suggestion, Ill keep trying at this and another idea without
pickle.

Justin
"Justin Straube" <justinstraube@ch> wrote in message
news:qp********************************@4ax.com.. .

Hello,

Im trying to compile a script with py2exe. The pickle module is causing
the
program to give an error.

Traceback (most recent call last):
File "SETIstat.pyw", line 330, in ?
File "SETIstat.pyw", line 84, in start_up
File "SETIstat.pyw", line 79, in config_load
File "pickle.pyc", line 1390, in load
File "pickle.pyc", line 872, in load
File "pickle.pyc", line 985, in load_string
LookupError: unknown encoding: string-escape

the data in the pickled file is a dictionary containing a couple strings.
The
strings do contain \n and \t charaters but no other special characters or
anything.

Does anyone have any suggestions to what I can try to get around this? The
pickle module works fine when the .pyw file is run. Its only when I
compile this
is there an issue.

Thanks for any help,

Justin




这篇关于泡菜和py2exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆