![]() |
Why do i get these errors? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Why do i get these errors? (/thread-31494.html) Pages:
1
2
|
Why do i get these errors? - Oshadha - Dec-15-2020 Hi I'm just a beginner programmer (13 yr old), pls help! So I was half-way through scripting the software, that saves student details in a csv file. when I want to see the students details I just simply type search {Student name} and some details come related. (Still need to be coded.) I need help on, Solving the errors. Improving the script. And how to make the body for this script.(Instead of running on the console, I need to change the appearance) Heres the script import csv import os.path import time import imp import sys if not os.path.exists("D:\My folder\Projects\Programing\Python\Student Data storing app\Register.csv"): #run start up script print("Cache was Deleted!\nCreating new Cache") time.sleep(3) with open ("D:\My folder\Projects\Programing\Python\Student Data storing app\Register.csv", "w") as new_file : fieldnames = ["Full name", "Phone 1", "Phone 2", "Identity Number", "Email", "Paid/not"] csv_writer = csv.DictWriter(new_file, fieldnames = fieldnames, delimiter = ",") csv_writer.writeheader() file = open ("D:\My folder\Projects\Programing\Python\Student Data storing app\Data.txt", "w") #creates our file to say startup is complete you could write to this if you wanted as well def pass_new(): password = input("Please enter a password.\nUse only letters.") pass_len = len(password) if pass_len < 10: print("Password saved!") file.write("Pass = " + password) else : print("Password must not exceed 10 characters.") sys.exit() pass_new() file.write() print("Startup is complete.") file.close def pass_check(): f = open("D:\My folder\Projects\Programing\Python\Student Data storing app\Data.txt") global data data = imp.load_source('data', '', f) f.close() correct_pass = data.Pass user_input_pass = input("Please enter your Password.") if user_input_pass == correct_pass: print("Password accepted!") else : print("Password incorrect.\nAccess denied!") sys.exit() pass_check() print("'add' - Adds a new user. \n'update' - Updates a user.") print("'remove' - Removes a user.\n {confrim}") user_input = input("Enter a command : ").lower() if user_input == "add": print("Command - 'add'\n{Fullname} {Phone 1} {Phone 2} {Identity Number} {Email} {Paid/not}") else : print("Error!\nPlease enter a valid option.") if user_input == "update": print("Command - 'update'\n{Fullname} {Phone 1} {Phone 2} {Identity Number} {Email} {Paid/not}") else : print("Error!\nPlease enter a valid option.") if user_input == "remove": print("Command - 'remove'\n {Full name} {Identity number} ") confirm = input("Please 'Confirm' removal of user.\nThis cannot be undone! ~~~ (Type 'confirm')").lower() if confirm == "confrim": print("User removed") else : print("User not removed. :D") else : print("Error!\nPlease enter a valid option.")The errors! I'm new to these forums, sorry If I didn't do this correctly.Always happy to learn! RE: Why do i get these errors? - buran - Dec-15-2020 Please, post the code here on the site, using BBCode tags. If you get any error, please, post the full traceback you get. Please, use proper tags when post code, traceback, output, etc. See BBcode help for more info. RE: Why do i get these errors? - Oshadha - Dec-16-2020 (Dec-15-2020, 08:54 AM)buran Wrote: Please, post the code here on the site, using BBCode tags. Sorry buran, Im hoping I did it correctly now! RE: Why do i get these errors? - buran - Dec-16-2020 (Dec-16-2020, 09:38 AM)Oshadha Wrote: Im hoping I did it correctly now!Yes, now it is OK. In the future, please, don't change content of your post after you have received a reply. This destroy the flow of conversation in the thread. Now, on the error: backslash \ has a special meaning when next char is one of several, e.g. n , u , etc. That is called escape sequence . You can find all escape sequences here. That's why you should be careful when use backslash in windows names. In your case the problem is \R You have 3 options:
RE: Why do i get these errors? - Oshadha - Dec-16-2020 (Dec-16-2020, 09:53 AM)buran Wrote: Yes, not it is OK. In the future, please, don't change content of your post after you have received a reply. This destroy the flow of conversation in the thread.Thanks!. From now on, I will do what you said! RE: Why do i get these errors? - Oshadha - Dec-16-2020 (Dec-16-2020, 09:53 AM)buran Wrote: Now, on the error:I will use option number 1. I think it will be the easiest! And thank you again! Have a nice day!! RE: Why do i get these errors? - Oshadha - Dec-16-2020 Is there any way of marking a reply as solved!? RE: Why do i get these errors? - Oshadha - Dec-16-2020 I cant post a new thread. Pls help! RE: Why do i get these errors? - buran - Dec-16-2020 (Dec-16-2020, 12:41 PM)Oshadha Wrote: I cant post a new thread.There is no restriction. What happens when you try to post new thread? RE: Why do i get these errors? - Oshadha - Dec-16-2020 (Dec-16-2020, 01:04 PM)buran Wrote: There is no restriction. What happens when you try to post new thread?I cant find the new thread/ new post button. I'm sorry I'm new! |