View Single Post
Join Date: Nov 2008
Posts: 2
Reputation: payne_99 is an unknown quantity at this point 
Solved Threads: 0
payne_99 payne_99 is offline Offline
Newbie Poster

Re: executing scripts via command line

 
0
  #3
Nov 21st, 2008
Ah, I see. So the actual command I was trying to execute was

  1. python controller.py

I checked controller.py, and got an error message:

Traceback (most recent call last):
File "C:\Users\p\controller.py", line 3, in <module>
exec "from " + sys.argv[1] + " import *"
IndexError: list index out of range

Here's the script:

  1. import sys
  2. from tichu import *
  3. exec "from " + sys.argv[1] + " import *"
  4.  
  5. def exampleFeatureFunction(hand):
  6. fv=[0, 0, 0]
  7. fv[0]=1
  8. if (hand[DRAGON]>0):
  9. fv[1]=1.0
  10. if (hand[PHOENIX]>0):
  11. fv[2]=1.0
  12. return fv
  13.  
  14. def alwaysSayNo(hand, model):
  15. return False
  16.  
  17. if __name__=="__main__":
  18. if (sys.argv[3]=="baseline"):
  19. evaluate(sys.argv[2], None, alwaysSayNo)
  20. elif (sys.argv[3]):
  21. evaluate(sys.argv[2], sys.argv[3], eval(sys.argv[4]))

There are other files (the "tichu" file it's importing from); let me know if you need to see more.
Reply With Quote