About Pickle's Import Error in Pyramid Application

26 views
Skip to first unread message

Yang Yang

unread,
Sep 10, 2012, 11:08:39 PM9/10/12
to pylons-...@googlegroups.com
Hi All,

I've encountered a problem with Pickle's load function.

I have the following code in an request handling part:

      

class Test():
    def __init__(self,name):
        self.name=name

@view_defaults(route_name='test')
class test_view(object):
        ...
        f = open('test.pkl', 'rb')
        self.test = pickle.load(f)
        f.close()


So far it works alright. 
However, when I move the class Test code to a separate file test.py
and use "import test" to import the module.

The pickle reports that it cannot find test module.

When I use the code in CherryPy, it works fine.

Could anyone help me to solve the problem?
 

best regards

Yang

Yang Yang

unread,
Sep 11, 2012, 10:43:24 AM9/11/12
to pylons-...@googlegroups.com
I solved the problem.
It has to do with Pickle package.
Reply all
Reply to author
Forward
0 new messages