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 6565267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:04:23+00:00 2026-05-25T14:04:23+00:00

I have a dictionary containing { Name : Email Address } I have a

  • 0

I have a dictionary containing { Name : Email Address }

I have a seperate .py to pickle this:

emailDict = {'Kilizo': 'info%40kilizo.com' , 'about': 'about%40google.com' }


# write python dict to a file

output = open('orig.pkl', 'wb')
pickle.dump(emailDict, output)
output.close()

which works, in that it pickles the original dictionary to orig.pkl

Then in my main website, i have:

# Pickling # Deleting Old Temp & Creating New One
tmp = os.path.isfile("tmp.pkl")
if tmp == True:
        os.remove("tmp.pkl")
shutil.copyfile("orig.pkl", "tmp.pkl")

# Pickling # Loading File
pkl_file = open('tmp.pkl', 'rb')
emailDict = pickle.load(pkl_file)
pkl_file.close()

I then have two form inputs on a website that take the email address and corresponding name

#Processing input
emailAdded = fs.getvalue('emailAdd')
nameAdded = fs.getvalue('nameAdd')
if  emailAdded != None or nameAdded != None:
    print emailAdded
    print nameAdded 
    emailDict[nameAdded] = emailAdded
else:
    print "Please enter a name & email address" 
output = open('tmp.pkl', 'wb')
pickle.dump(emailDict, output)
output.close()
print emailDict

However no new data gets stored to either tmp.pkl or orig.pkl

Any ideas to get me started?

Thanks

  • 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. Editorial Team
    Editorial Team
    2026-05-25T14:04:23+00:00Added an answer on May 25, 2026 at 2:04 pm

    Any ideas to get me started?

    Using pickle as a dynamically updated data store for a website isn’t great. In order to avoid concurrency issues you’ll have to implement a lockfile mechanism and hope that everything else that accesses the file will respect it.

    I strongly suggest that you use a data store that supports concurrent access. E.g. a database.

    Have a read of: http://en.wikipedia.org/wiki/Concurrency_control


    You could start easy with sqlite. See:
    http://docs.python.org/library/sqlite3.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need advice. I have application that imports 10,000 rows containing name & address
I'm trying to map a Dictionary containing Lists. I have the following set of
How can I get my object index? I have a dictionary containing arrays and
I have an NSArray storing NSDictionaries. Each dictionary has two keys; a name and
I have a dictionary containing the character positions of different fields in a string.
If I have a dictionary containing 2 or more lists, how can I quickly
I have recently written a LINQ query to get a Dictionary containing the last
I have a Dictionary containing 10 keys, each with a list containing up to
I have the following code which produces a dictionary containing multiple lists; each list
I have a dictionary containing a second dictionary with 1000 entries. The entries are

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.