Problems with pickling data
<pre><code>import random
import pickle, shelve
import os
#import RPi.GPIO as GPIO | Raspberry pi only
import tkinter
import sys
import time

class Operator(object):
    global list_name
    def __init__(self):

        print("Welcome to Python OS 1.0")
        print("type 'help' to access help...") # ADD CODE OS.REMOVE("FILE")    
    def CheckDetails(self):
        if not os.path.isfile( 'details.dat' ) :
            data=[0]
            data[0] = input('Enter Your Name: ' )
            file= open( 'details.dat' , 'wb' )
            pickle.dump( data , file )
            file.close() 
        else :
            File = open( 'details.dat' , 'rb' )
            data = pickle.load( File )
            file.close()
            user = ""
            while user != data[0]:
                input("please enter your username...")
            print( 'Welcome Back To Python OS, '+ data[0])

    def Help(self):
        print("""
write(sentence) - Prints the typed sentence on the screen
open(file, mode) - Opens the file and mode such as 'r'
create(listName) - creates the list, listName
add(data, listName) - adds the data to listName
remove(data, listName) - removes the selected data from listName
              """)
    def write(self, sentence):
        print(sentence)

    @classmethod
    def create(self):
        list_name = input("Please enter the list name...")
        vars()[list_name] = []
        time.sleep(1)
        print("List (" + list_name + ") created")

    def add(self):
        data = input("Please specify the data to be added...")
        list_name += data

    def remove(self, data, list_name):
        remove_data = input("Plese specify the data to be removed...")
        list_name -=  data


def main():

    os = Operator()
    os.CheckDetails()
    ans = ""
    ans = ans.lower()
    while ans != "quit":
        ans = input()

        if ans == "write":
            os.write()
        elif ans == "help":
            os.Help()
        elif ans == "create":
            os.create()
        elif ans == "add":
            os.add()
        elif ans == "remove":
            os.remove()
        elif ans == "quit":
            break
        else:
            print("Sorry, that command does not exist or it will be added into a future update...")
    print("goodbye...")
main()
</code></pre>

<p>I am trying to make some sort of simplified python, but hitting errors only on the <code>CheckDetails()</code> function. I'm pickling data (which is fine) but getting errors when making the user check his or her username is correct, I've tested it and even though I have typed in the correct username, it carry's on asking for my username. Can anyone please help? </p>

<p>You have a while loop that will execute forever because you are not assigning your user variable to anything.
    while user != data[0]:
        user = input("please enter your username...")
        print( 'Welcome Back To Python OS, '+ data[0])</p>

python python-3.x pickle