I am pretty new to python scripts in linux and executing them in the terminal. I am trying to debug a few scripts that interact with each other, but i don't understand how to access certain parts of the script in the command line. Below is an example test script I'm practicing with.
The file is called:
test.py
The script is:
class testClass():
def __init__(self, test):
self.test = test
def testing():
print "this wont print"
def testing2():
print "but this works"
In the terminal if I go to the folder where the file is located and try to print the testing() function
python -c 'import test; print test.testClass.testing()'
I get an error saying
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: unbound method testing() must be called with testClass instance as first argument (got nothing instead)
But if i try to print the testing2() function
python -c 'import test; print test.testing2()'
It will print "but this works"
How would i go about executing the testing() function to make it print. I've tried putting various arguments in there but nothing works.
Thanks