473,378 Members | 1,138 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

ImportError in Unpickle

Hi,

I have a python script that pickles and unpickles a give object. It
works without any problems on windows (the data was pickled on windows
first). But when I try to run the script on Linux, I get the following
error:

mydbinfo = pickle.Unpickler(f).load()
File "/usr/lib/python2.3/pickle.py", line 872, in load
dispatch[key](self)
File "/usr/lib/python2.3/pickle.py", line 1083, in load_inst
klass = self.find_class(module, name)
File "/usr/lib/python2.3/pickle.py", line 1138, in find_class
__import__(module)
ImportError: No module named __main__

Even running the script with cygwin's python results in same error. It
looks me to be some problem with path setting for finding modules. Can
someone shed more light?

Thanks in advance,
Raghu.

Feb 26 '06 #1
3 3479
dr*******@gmail.com:
I have a python script that pickles and unpickles a give object. It
works without any problems on windows (the data was pickled on windows
first). But when I try to run the script on Linux, I get the following
error: [...]ImportError: No module named __main__


There are some posts in the Usenet archive that suggest you need to open
the pickled file in binary mode.
http://groups.google.nl/group/comp.l...85a7a5723f3b03

--
René Pijlman
Feb 26 '06 #2
Rene Pijlman:
dr*******@gmail.com:
ImportError: No module named __main__


There are some posts in the Usenet archive


Also:
http://mail.python.org/pipermail/pyt...il/000916.html

--
René Pijlman
Feb 26 '06 #3

It is indeed the problem. Thanks.

May be, this fact could have been mentioned in the documentation. I
have suggested the change using bug tracker.

Raghu.

Feb 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Carsten Gehling | last post by:
Figured out myself - I just removed the line with "from url import Url" -it doesn't seem to be used anywhere ;-) - Carsten > -----Oprindelig meddelelse----- > Fra:...
2
by: x-herbert | last post by:
Hi, I have a small test to "compile" al litle script as a WMI-Tester. The script include a wmi-wrapper and "insert" the Win32-modeles. here the code: my "WMI-Tester.py" ----- import wmi
0
by: Wicked | last post by:
Hi all, Has anyone got rpm.py? Is this a class/module for Python? I am getting the following error: File "./extra/scripts/update_release.py", line 42, in ? import rpm ImportError: No...
7
by: Yun Mao | last post by:
Hi, I'm looking for a way in unpickling, or equivalent, such that can only unpickle (or is limited to) simple data structure, such as number, string, list, tuples. The doc I found...
2
by: Adam Blinkinsop | last post by:
I'm writing a set of modules to monitor remote system services, and I'm having a problem running my test scripts. When I pass the scripts into python, like so: -- $ PYTHONPATH="${TARGET_DIR}"...
4
by: Ted Zeng | last post by:
Hi, I store some test results into a database after I use python To pickle them (say, misfiles=) Now I want to display the result on a web page which uses PHP. How could the web page...
6
by: Alan Isaac | last post by:
I am on a Windows box. I pickle a tuple of 2 simple objects with the pickle module. It pickles fine. It unpickles fine. I upload to a server. I try to unpickle from the URL. No luck. Try...
2
by: Danny Shevitz | last post by:
Howdy, In my app I need to exec user text that defines a function. I want this function to unpickle an object. Pickle breaks because it is looking for the object definition that isn't in the...
4
by: Daniel | last post by:
Hello, I'm trying to build a very simple IPC system. What I have done is create Data Transfer Objects (DTO) for each item I'd like to send across the wire. I am serializing these using...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.