469,609 Members | 1,634 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Cpickle module... not in Lib installs

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

Jul 18 '05 #1
5 9194
In <11**********************@g14g2000cwa.googlegroups .com>, Marcus Lowland
wrote:
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:
import cPickle
cPickle.__file__

'/usr/lib/python2.4/lib-dynload/cPickle.so'

Ciao,
Marc 'BlackJack' Rintsch
Jul 18 '05 #2
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.
import cpickle
Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
import cpickle
ImportError: No module named cpickle


Jul 18 '05 #3
Marcus Lowland wrote:
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.
import cpickle
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. import cpickle Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named cpickle import cPickle
cPickle <module 'cPickle' from '/usr/local/lib/python2.4/lib-dynload/cPickle.so'>


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

--
Website: www DOT jarmania FULLSTOP com
Jul 18 '05 #4
Marcus Lowland wrote:
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]
import cPickle # 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

Jul 18 '05 #5
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

Jul 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Drochom | last post: by
reply views Thread by Guenter Walser | last post: by
reply views Thread by paul | last post: by
2 posts views Thread by sh | last post: by
5 posts views Thread by Bill Mill | last post: by
2 posts views Thread by les | last post: by
1 post views Thread by Carl J. Van Arsdall | last post: by
reply views Thread by Roopesh | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.