Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 74017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:17:32+00:00 2026-05-10T20:17:32+00:00

I have an application that imports data from a pickled file. It works just

  • 0

I have an application that imports data from a pickled file. It works just fine in Windows but Mac and Linux behaviour is odd.

In OS X, the pickled file (file extension ‘.char’) is unavailable as a selection unless I set the file type to *.*. Then, if I select a file that has the .char extension, it won’t load, giving the error

unpickle_file = cPickle.load(char_file)  

ValueError: could not convert string to float

However, if I create a file that doesn’t have the .char extension, that file will load up just fine.

In Linux, when I use the ‘file open’ dialog, my pickled files aren’t visible, whether or not they have a file extension. However, I can see them under Nautilus or Dolphin. They simply don’t exist to my application though.


Edit Here’s the save code:

def createSaveFile(self):         '''Create the data files to be saved and save them.          Creates a tuple comprised of a dictionary of general character information         and the character's skills dictionary.'''         if self.file_name:             self.save_data = ({'Name':self.charAttribs.name,                <snip>                   self.charAttribs.char_skills_dict)             self.file = open(self.file_name, 'w')             cPickle.dump(self.save_data, self.file)         self.file.close() 

Here’s the open code:

 def getCharFile(self, event): # wxGlade: CharSheet.<event_handler>         '''Retrieve pickled character file from disk.'''         wildcard = 'Character files (*.char) | *.char | All files (*.*) | *.*'                 openDialog = wx.FileDialog(None, 'Choose a character file', os.getcwd(),         '', wildcard, wx.OPEN | wx.CHANGE_DIR)         if openDialog.ShowModal() == wx.ID_OK:             self.path = openDialog.GetPath()         try:             char_file =  open(self.path, 'r')             unpickle_file = cPickle.load(char_file)             char_data, char_skills = unpickle_file             self.displayCharacter(char_data, char_skills)         except IOError:             self.importError = wx.MessageDialog(self,              'The character file is not available!',             'Character Import Error', wx.OK | wx.ICON_ERROR)             self.importError.ShowModal()             self.importError.Destroy()             openDialog.Destroy() 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:17:33+00:00Added an answer on May 10, 2026 at 8:17 pm

    Probably you didn’t open the file in binary mode when writing and/or reading the pickled data. In this case newline format conversion will occur, which can break the binary data.

    To open a file in binary mode you have to provide ‘b’ as part of the mode string:

    char_file = open('pickle.char', 'rb') 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 273k
  • Answers 274k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This should work: where (s.Class == Class && s.Year ==… May 13, 2026 at 2:16 pm
  • Editorial Team
    Editorial Team added an answer Well, basically you can either put your shared types into… May 13, 2026 at 2:16 pm
  • Editorial Team
    Editorial Team added an answer Whatever version of GreaseKit is installed on your machine (as… May 13, 2026 at 2:16 pm

Related Questions

I have an importer process which is running as a windows service (debug mode
[edit] We're collecting credit application data from users on a web form. I have
Is there any way to stop a running loop inside another method or insert
I have a python project with this directory structure and these files: /home/project_root |---__init__.py

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.