Some issues with your code:
Python is case-sensitive. The keyword is
class, notClass.After the line
class Athere has to be a colon:class A:If the function
myFunctionis supposed to be part ofclass A, it has to be indented:class A: def myFunction(a,b)Methods of classes should have
selfas first parameter:def myFunction(self, a, b)After
def myFunction(self, a,b)there has to be a colon:def myFunction(self, a,b):Your function must have at least one line of indented code following. If it is supposed to do nothing, you can use the keyword `pass:
def myFunction(self, a,b): passIf you want to use
sys.argvyou first have to importsysat the beginning of your code withimport sys.myFunctionis part of a class, you first have to instantiate it to use the function:Av = A() Av.myFunction(a,b)The first commandline argument is the second entry of
sys.argv, not the first.
However it seems to me that you don't want a class anyway, so just write:
def myFunction(a,b):
pass
if __name__ == '__main__':
a = sys.argv[1]
b = sys.argv[2]
myFunction(a,b)
Also you call python scripts with python file.py arg1 arg2. If you want to omit python at the beginning then you can (in unix-like systems) add a shebang in the first line of the python-file: #!/usr/bin/env python. Then as long as the execution flag is set chmod +x file.py it may be called like ./file.py arg1 arg2.
Some issues with your code:
Python is case-sensitive. The keyword is
class, notClass.After the line
class Athere has to be a colon:class A:If the function
myFunctionis supposed to be part ofclass A, it has to be indented:class A: def myFunction(a,b)Methods of classes should have
selfas first parameter:def myFunction(self, a, b)After
def myFunction(self, a,b)there has to be a colon:def myFunction(self, a,b):Your function must have at least one line of indented code following. If it is supposed to do nothing, you can use the keyword `pass:
def myFunction(self, a,b): passIf you want to use
sys.argvyou first have to importsysat the beginning of your code withimport sys.myFunctionis part of a class, you first have to instantiate it to use the function:Av = A() Av.myFunction(a,b)The first commandline argument is the second entry of
sys.argv, not the first.
However it seems to me that you don't want a class anyway, so just write:
def myFunction(a,b):
pass
if __name__ == '__main__':
a = sys.argv[1]
b = sys.argv[2]
myFunction(a,b)
Some issues with your code:
Python is case-sensitive. The keyword is
class, notClass.After the line
class Athere has to be a colon:class A:If the function
myFunctionis supposed to be part ofclass A, it has to be indented:class A: def myFunction(a,b)Methods of classes should have
selfas first parameter:def myFunction(self, a, b)After
def myFunction(self, a,b)there has to be a colon:def myFunction(self, a,b):Your function must have at least one line of indented code following. If it is supposed to do nothing, you can use the keyword `pass:
def myFunction(self, a,b): passIf you want to use
sys.argvyou first have to importsysat the beginning of your code withimport sys.myFunctionis part of a class, you first have to instantiate it to use the function:Av = A() Av.myFunction(a,b)The first commandline argument is the second entry of
sys.argv, not the first.
However it seems to me that you don't want a class anyway, so just write:
def myFunction(a,b):
pass
if __name__ == '__main__':
a = sys.argv[1]
b = sys.argv[2]
myFunction(a,b)
Also you call python scripts with python file.py arg1 arg2. If you want to omit python at the beginning then you can (in unix-like systems) add a shebang in the first line of the python-file: #!/usr/bin/env python. Then as long as the execution flag is set chmod +x file.py it may be called like ./file.py arg1 arg2.
Some issues with your code:
- Python is case-sensitive. The keyword is
class, notClass.Python is case-sensitive. The keyword is
class, notClass. - After the line
class Athere has to be a colon:class A:After the line
class Athere has to be a colon:class A: - If the function
myFunctionis supposed to be part ofclass A, it has to be intended:If the function
myFunctionis supposed to be part ofclass A, it has to be indented:class A: def myFunction(a,b) Methods of classes should have
selfas first parameter:def myFunction(self, a, b)After
def myFunction(self, a,b)there has to be a colon:def myFunction(self, a,b):Your function must have at least one line of indented code following. If it is supposed to do nothing, you can use the keyword `pass:
def myFunction(self, a,b): passIf you want to use
sys.argvyou first have to importsysat the beginning of your code withimport sys.myFunctionis part of a class, you first have to instantiate it to use the function:Av = A() Av.myFunction(a,b)The first commandline argument is the second entry of
sys.argv, not the first.
However it seems to me that you don't want a class A: def myFunction(aanyway,b) 4. After so just write:
def myFunction(a,b):
pass
if __name__ == '__main__':
a = sys.argv[1]
b = sys.argv[2]
myFunction(a,b)
Some issues with your code:
- Python is case-sensitive. The keyword is
class, notClass. - After the line
class Athere has to be a colon:class A: - If the function
myFunctionis supposed to be part ofclass A, it has to be intended:
class A: def myFunction(a,b) 4. After
Some issues with your code:
Python is case-sensitive. The keyword is
class, notClass.After the line
class Athere has to be a colon:class A:If the function
myFunctionis supposed to be part ofclass A, it has to be indented:class A: def myFunction(a,b)Methods of classes should have
selfas first parameter:def myFunction(self, a, b)After
def myFunction(self, a,b)there has to be a colon:def myFunction(self, a,b):Your function must have at least one line of indented code following. If it is supposed to do nothing, you can use the keyword `pass:
def myFunction(self, a,b): passIf you want to use
sys.argvyou first have to importsysat the beginning of your code withimport sys.myFunctionis part of a class, you first have to instantiate it to use the function:Av = A() Av.myFunction(a,b)The first commandline argument is the second entry of
sys.argv, not the first.
However it seems to me that you don't want a class anyway, so just write:
def myFunction(a,b):
pass
if __name__ == '__main__':
a = sys.argv[1]
b = sys.argv[2]
myFunction(a,b)
Some issues with your code:
- Python is case-sensitive. The keyword is
class, notClass. - After the line
class Athere has to be a colon:class A: - If the function
myFunctionis supposed to be part ofclass A, it has to be intended:
class A: def myFunction(a,b) 4. After