Reputation: 1111
I am using Python 3.2 and Eclipse classic as an IDE. I m trying to add the users in rawinput to the existing group North_AMERICAS using a command as shown below. I tested the cmd and it does its job. Now for all the users in the rawinput, I want to add them to the group using python script. Below is my code and the error msg. Can you please let me know what am I missing? Thanks.
# coding=UTF-8
import subprocess
def AddUsers():
rawinput = ('corp\\arrigh', 'corp\\banjar', 'corp\\bicknk', 'corp\\BINDEM')
for user in rawinput:
rs = subprocess.call("c:/dicfg -remote admin:admin@myserver:2130 add user -user "+user+" -groups North_AMERICAS")
print(user)
AddUsers()
ERROR:
Traceback (most recent call last):
File "C:\eclipse\Eclipse\eclipse\plugins\org.python.pydev.debug_2.5.0.2012040618\pysrc\pydev_runfiles.py", line 307, in __get_module_from_str
mod = __import__(modname)
File "C:/Documents and Settings/user21/Shworkspace/PYTHON TEST\PYTEST.py", line 5, in <module>
for user in rawinput:
NameError: name 'rawinput' is not defined
ERROR: Module: PYTEST could not be imported (file: C:\Documents and Settings\user21\Shworkspace\PYTHON TEST\PYTEST.py).
Upvotes: 0
Views: 234
Reputation: 16605
As per the comments, it's an indentation problem: for
should be under the previous line's rawinput
.
Upvotes: 2