By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

Cpickle module... not in Lib installs

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.