1

Hi I am trying to rum a C *.o using python 2.6.5 as follows

import os
import sys
file_type = os.command('./file_type.o %s.txt 2>&1' % file_name)

And, it gives the error message :

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'command'

Being a beginner this might be a very trivial question, I request for the direction / help.

Andy
50.9k62 gold badges181 silver badges240 bronze badges
asked Nov 4, 2014 at 5:09
1
  • Where did you read that os.command() is the way to do this? Commented Nov 4, 2014 at 5:12

3 Answers 3

3

There is no function named command in the os module, hence the error. You probably meant to call os.system() instead.

answered Nov 4, 2014 at 5:12
Sign up to request clarification or add additional context in comments.

Comments

1

os.command() doesn't exist. It looks like you are looking for os.system()

answered Nov 4, 2014 at 5:12

Comments

1

os.command doesn't exist, using os.system instead.

answered Nov 4, 2014 at 5:22

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.