Crash with cPickle and NumPy when diff directory

yelled at yahoo.com yelled at yahoo.com
Wed Nov 8 21:32:00 CET 2000


Hi,

  Just reporting a problem. I can live with it, but would like others
to know.
------------------ I ran this prg --------------
import cPickle, string as S
import Numeric as N
fp = open('Params.txt')
lines = fp.readlines()
fp.close()
ParamDict = {}
ParamDict['Params'] = map(lambda x: S.split(x, '\t'), lines)
ParamDict['Headrs'] = ['CUSIP', 'Ticker', 'Exch', 'Name']
#print 'No longer active', N.sum(N.not_equal(map(len, ParamDict
['Params'][:, 2]), 2))
#print 'Not in S&P',       N.sum(map(lambda x: x[0]=='#', ParamDict
['Params'][:, -1]))
fw = open('Params.pkl', 'wb')
cPickle.dump(ParamDict, fw)
fw.close()

--------- Then I tried to read it back using------------
import cPickle, pickle
PDict = pickle.load(open(r'..\Data\Params.pkl', 'rb'))
------------

The funky thing is that I can read back from same directory, but when I
tried to read from another directory it fails. The problem is due to
the fact that cPickle has problem handling pickled 'O' arrays in NumPy,
when I am reading from another directory. This is bit curious.
I changed to a regular list and I had no problem. I have 100MB 'f'
array and that get unPickled from another directory.
  Thanks,

Hoon,

Oh, here's my sys info
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
HP XU800 Kayak NT4 svc pack 6 256MB


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list