mercredi 1 avril 2015

Running Python on Windows from Shell

So I've got some script named 'some_class.py' located in the same folder as python.exe:



from __future__ import print_function

class some_class:
def say_it(self):
print('hello')

def main():
instance = some_class()
instance.say_it()

if __name__ == '__main__':
main()


When I try running it with the following command while in Python Shell inside PowerShell:



some_class.py


I get:



Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'some_class' is not defined


Python's version is 3.4.1. What am I doing wrong?


Aucun commentaire:

Enregistrer un commentaire