0

(Python) <Variable Name> is not defined

I have tried many times but still no result I get the error: infochar is not defined I tried by recording the variables one by one but it still doesn't work Have a look at this photo: https://drive.google.com/file/d/1wAcMjCpvwL_IZjvlZTXtzmJHJe0Iw5uP/view?usp=sharing I have no way to resolve the error at all. Please help me ---NOTE--- Below are 2 corrupted python files. The main file is not corrupted. Only error in the extra file Don't forget to rename the extra file to dtbase_plugin.py and leave the 2 files in the same place with an empty file named __init__.py . But if you don't do it, you'll get more errors than I did --LINK-- Main file (run this): https://code.sololearn.com/cA104A19a7A2 Extra file (plugin, need to run the main file, this is a corrupted file): https://code.sololearn.com/cA18A4A13A05

12th Jun 2021, 4:25 PM
Nguyễn Quốc Hưng
Nguyễn Quốc Hưng - avatar
4 Answers
+ 1
when you write a class, try making the first method, THAT classes __init__ method. So: class DatabasePlugin: def __init__(self): """Setting up classe's INITial values""" self.name = None # no need for a variable to hold attributes self.gender = None # a class can hold it's own with the 'self' parameter. it refers to the class object. ... look at this example of a class and see if if makes any sense https://code.sololearn.com/cIF9P01jRV81/?ref=app
12th Jun 2021, 4:46 PM
Slick
Slick - avatar
+ 1
Hello, I'm back Thank you, Slick You made me fix the code. Thank you and the example you provided me
17th Jun 2021, 4:47 PM
Nguyễn Quốc Hưng
Nguyễn Quốc Hưng - avatar
0
I did not test your code, but at a glance, I suggest putting: global infochar at the top of the function.
12th Jun 2021, 4:52 PM
Jerry Hobby
Jerry Hobby - avatar
0
Hi Jerry Hobby, thanks for the suggestion but... still doesn't work
17th Jun 2021, 2:14 PM
Nguyễn Quốc Hưng
Nguyễn Quốc Hưng - avatar