On Wed, Apr 2, 2008 at 5:23 PM, <[EMAIL PROTECTED]> wrote:

> Still no luck:
>
> Traceback (most recent call last):
>  File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework
> \scriptutils.py", line 310, in RunScript
>    exec codeObject in __main__.__dict__
>  File "C:\text analysis\pickle_test2.py", line 13, in ?
>     cPickle.dump(Data_sheet, pickle_file, -1)
> PicklingError: Can't pickle <type 'module'>: attribute lookup
> __builtin__.module failed
>
> My code remains the same, except I added 'wb' and the -1 following
> your suggestions:
>
> import cPickle,xlrd, sys
>
> print sys.version
> print xlrd.__VERSION__
>
> data_path = """C:\\test\\test.xls"""
> pickle_path = """C:\\test\\pickle.pickle"""
>
> book = xlrd.open_workbook(data_path)
> Data_sheet = book.sheet_by_index(0)
>
> pickle_file = open(pickle_path, 'wb')
> cPickle.dump(Data_sheet, pickle_file, -1)
> pickle_file.close()
>

FWIW, it works here on 2.5.1 without errors or warnings. Ouput is:
2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
0.6.1

...


> My code does this, except sort returns None, which is strange.


list.sort() is documented to return None. See sorted().

--
kv
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to