Cpickle module... not in Lib installs

M

Marcus Lowland

Hello, I'm fairly new to python and have read about and wanted to begin
experimenting with cpickle. As I understand, this should be a native
module in the python library. I have python 2.3 and now just installed
2.4, but am not able to import or find cpickle.py in any directory of
the install, or in the previous version (pickle.py is present and
imports correctly). Is there a seperate module package that must be
downloaded and installed... or am I overlooking the obvious.

Would appreciate any suggestions on how to acquire/load the module.

Regards,
Marcus
 
M

Marc 'BlackJack' Rintsch

Marcus Lowland said:
Hello, I'm fairly new to python and have read about and wanted to begin
experimenting with cpickle. As I understand, this should be a native
module in the python library. I have python 2.3 and now just installed
2.4, but am not able to import or find cpickle.py in any directory of
the install, or in the previous version (pickle.py is present and
imports correctly). Is there a seperate module package that must be
downloaded and installed... or am I overlooking the obvious.

Yes, the spelling:
'/usr/lib/python2.4/lib-dynload/cPickle.so'

Ciao,
Marc 'BlackJack' Rintsch
 
M

Marcus Lowland

Thanks Marc, but... I've searched the file directories for cpickle (not
specifying file type) and only came up with test_cpickle.py. Also, if
cPickle.so were the correct file and existed in my lib then the
following would not happen.

Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
import cpickle
ImportError: No module named cpickle
 
T

Tim Jarman

Marcus said:
Thanks Marc, but... I've searched the file directories for cpickle (not
specifying file type) and only came up with test_cpickle.py. Also, if
cPickle.so were the correct file and existed in my lib then the
following would not happen.


Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
import cpickle
ImportError: No module named cpickle

Au contraire, the spelling *is* important:

Python 2.4 (#1, Dec 31 2004, 17:21:43)
[GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):

Python is case-sensitive, and this extends to imports (modulo the
idiosyncrasies of the underlying OS).
 
J

John Machin

Marcus said:
Hello, I'm fairly new to python and have read about and wanted to begin
experimenting with cpickle. As I understand, this should be a native
module in the python library. I have python 2.3 and now just installed
2.4, but am not able to import or find cpickle.py in any directory of
the install, or in the previous version (pickle.py is present and
imports correctly). Is there a seperate module package that must be
downloaded and installed... or am I overlooking the obvious.

Would appreciate any suggestions on how to acquire/load the module.

(1) Anything built-in is unlikely to be found as Anything.py

(2) If the docs mention a module called xYzzy, you import it by "import
xYzzy" -- being careful about case. cPickle's name *is* a bit deviant,
isn't it? If you have Python, you have already acquired the module.

For an insight into what comes from where, and how hard that little
black duck is paddling under the water on your behalf, try this:

os-command-prompt>python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# c:\Python24\lib\site.pyc matches c:\Python24\lib\site.py
import site # precompiled from c:\Python24\lib\site.pyc

[BIG snip]
# c:\Python24\lib\encodings\cp437.pyc matches
c:\Python24\lib\encodings\cp437.py
import encodings.cp437 # precompiled from
c:\Python24\lib\encodings\cp437.pyc
import cPickle # builtin
import cStringIO # builtin
HTH,
John
 
M

Marcus Lowland

Arrrrrrghh, I forgot about case sensitivities.... sorry about that
guys, I'm so used to not having to think about that. Thanks for having
patience with me and thanks for the explanations.

import cPickle

hehe... damn... tricky getting used to that :)

Thanks again,
Marcus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,229
Messages
2,571,160
Members
47,786
Latest member
DorothyWoo

Latest Threads

Top