0

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).
3
  • 1
    It looks like you have indentation problems - if, indeed, you formatted your question correctly (for should be under the previous line's rawinput). Commented Jun 4, 2012 at 19:43
  • @malenkiy_scot- Thank you very much for your help. I m very new to python and eclipse IDE. Thanks for being so nice. :) Commented Jun 4, 2012 at 19:52
  • Ok, so it's not formatting problem. Then I'll post it as an 'official' answer, Commented Jun 4, 2012 at 19:56

1 Answer 1

2

As per the comments, it's an indentation problem: for should be under the previous line's rawinput.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. Yes it was just the indentation prob. Thanks for helping me figure this out.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.