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

  • SEARCH
  • Home
  • 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

Related Questions

I have an existing application that imports data from a web site api into
I have an application that takes a table of data from Excel, and imports
I have an application that imports data read from text files from a directory
I have written an application in Delphi 2010 that imports data from one database
I have written a database app that imports data from an excel file into
I have an application that imports data from Excel. However, when I run the
imagine a situation where you have an application that needs to import data from
I have an application that works with a lot of XML data. So, I
Background I have an application that receives periodic data dumps (XML files) and imports
At the moment I'm coding a web application that imports image data from Google

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.