Python 3.2 using a subprocess module -
i using python 3.2 , eclipse classic ide. m trying add users in rawinput existing group north_americas using command shown below. tested cmd , job. users in rawinput, want add them group using python script. below code , error msg. can please let me know missing? thanks.
# coding=utf-8 import subprocess def addusers(): rawinput = ('corp\\arrigh', 'corp\\banjar', 'corp\\bicknk', 'corp\\bindem') 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 , settings/user21/shworkspace/python test\pytest.py", line 5, in <module> user in rawinput: nameerror: name 'rawinput' not defined error: module: pytest not imported (file: c:\documents , settings\user21\shworkspace\python test\pytest.py).
as per comments, it's indentation problem: for should under previous line's rawinput.
Comments
Post a Comment