Question
My code so far is giving out an error, it is in separate files (3 to be exact). I will post the error at the
My code so far is giving out an error, it is in separate files (3 to be exact). I will post the error at the bottom that I keep receiving. I have tried to mess with it some but I feel as if I am just making it worse. Any help or a push in the right direction would leave me grateful, thank you. I would shorten this but I have to show my effort in this and how I may have been doing this wrong, my apologies ahead of time. All 3 files correlate with each other which is why I posted all 3 of them.
NETMANAGE file
# TODO: Import VLANSetup from VLANSetup.py
from VLANSetup import VLANSetup
class NetManage:
def __init__(self):
self.device = "None"
self.config.number = VLANSetup()
def __init__(self, device, config):
self.device = device
self.config.number = config
# TODO: Define constructor with parameters to initialize instance attributes
#(device, config)
def print_info(self):
print('Configuring VLAN: %s' % (self.config.number))
print('Connecting to: {}'.format(self.device))
self.config.print_info()
print()
MAIN.PY File
# TODO: Import VLANSetup from VLANSetup.py and NetManage from NetManage.py
from VLANSetup import VLANSetup
from NetManage import NetManage
if __name__ == "__main__":
deviceList = ['Switch1', 'Switch2', 'Switch3', 'Switch4', 'Switch5']
user_VLAN_name = input()
user_VLAN_number = int(input())#10 -> 200
for d in deviceList:
user_device = VLANSetup(user_VLAN_name, user_VLAN_number)
new_config = NetManage(d, user_device)
new_config.print_info()
VLANSetup File
class VLANSetup:
def __init__(self, name = "None", number = 0):
self.name = name
self.number = number
# TODO: Define constructor with parameters to initialize instance attributes
#(name, number)
def print_info(self):
print('Sending Config vlan: {}'.format(self.number))
print('Sending Config name: {}'.format(self.name))
The error I keep receiving:
Traceback (most recent call last):
File "main.py", line 12, in
new_config = NetManage(d, user_device)
File "/home/runner/local/submission/NetManage.py", line 10, in __init__
self.config.number = config
AttributeError: 'NetManage' object has no attribute 'config'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started