خرید بک لینک

Vote count: 0

I am trying to create a .txt file in a folder which is not the directory the script is being run from. I have a folder where the script is, and I am able to create the folder in the same directory the script is in but It won't create the text file in the folder. I usually run in to one of two errors: PermissionError: [Ero 13] Permission deniedor, FileNotFoundError: [Ero 2] No such file or directory:

This is for a password keeper btw, and to prevent five people telling me it's not secure, I am aware of this, this project is purely educational and I always use placeholders.

Here is my code:

def main():
    import os
    import os.path
    abc = open("userpassfile.txt", "r+")
    userpassfile = abc.read().strip().split()
    actCheck = input('Do you already have an account?')
    if (actCheck == 'Yes' or actCheck == 'yes'):
        loginUser = input('What is your useame?')
        loginPass = input('What is yout password?')
        if (loginUser and loginPass in userpassfile):
            dirCheck = input('Account Settings? [y/n]')
            if (dirCheck == 'y' or dirCheck == 'Y'):
                print('This function is not working yet!')
                addpassCheck = input('Would you like to add a password?')
                if (addpassCheck == 'yes' or addpassCheck == 'Yes'):
                    abc123 = open(loginUser + '.txt', "r+")
                    huehuehue = abc123.read().strip().split()
                    addpass1 = input('What service is the pass')
                    addPass2 = input('What is the password')
                    abc123.write('(' + addpass1 + ',' + addPass2 + ')' + 'n')

                else:
                    print('hihi')
            else:
                print("hehe")
        else:
            print('Incorrect password or useame!')
    else:
        createAct = input('would you like to create one?')
        if (createAct == 'Yes' or createAct == 'yes'):
            save_path = 'C:/Users/Ari Madian/Desktop/Scripts/Python Scripts/Python Password Project'
            createUser = input('What would you like your useame to be?:')
            createPass = input('What would you like your password to be?:')
            abc.write(createUser + 'n')
            abc.write(createPass + 'n')
            os.makedirs(createUser)
            completeName = os.path.join(save_path, createUser + ".txt")



main()

If you have any questions about my code, feel free to ask!

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 30 فروردين 1395 ساعت: 3:54

صفحه بندی