Running a python script named automator.py
from the command line using powershell on windows 7.
python .\automator.py
automator.py
file looks like this....
import os
ipAddressFile = os.path.join("DCM_Info", "ip_address")
ipAddresses = getIpAddresses()
for ip in ipAddresses:
print str(ip)
cmd = "python run.py " + ip + " get_transrator_settings"
os.system(cmd)
def getIpAddresses():
f = open(ipAddressFile, 'r')
return f.readlines()
Why am I getting an error that the name of the method is undefined?
NameError: name 'getIpAddresses' is not defined
I'm used to C#/Java where you have a main method that starts the program and classes that have constructors. Do I need to have a constructor or a class? Is that necessary?