0

I normally program in Java, but started learning Python for a course I'm taking.

I couldn't really start the first exercise because the command

python count_freqs.py gene.train > gene.counts 

didn't work, I keep getting "incorrect syntax" messages. I tried solving this looking at dozens of forums but nothing works, and I'm going crazy.

import count_freqs 

ran without errors, but I can't do anything with it. When I try running something involving the file gene.train I get "gene is not defined".

Can anyone tell me what I'm doing wrong? Thanks.

glautrou
3,2182 gold badges33 silver badges35 bronze badges
asked Aug 20, 2013 at 21:37
4
  • 4
    It's hard to tell without the actual code you are trying to run. Please provide. Commented Aug 20, 2013 at 21:37
  • It sounds like you are trying to execute the python script within the python interactive shell. You need to run this within your normal shell (bash, csh, windows command prompt, etc...) Commented Aug 20, 2013 at 21:57
  • how are you handling parsing arguments? does it have a if __name__ == '__main__': line ? need moar code Commented Aug 20, 2013 at 23:38
  • Thanks SethMMorton, you're right. Sorry for the rookie mistake, I guess this was so obvious to most that no one bothered to explain it in the description of the exercise or in other forums. Commented Aug 21, 2013 at 6:19

2 Answers 2

1

type which python at the command prompt to see if the python executable is in your path. If not it either isn't installed or you need to amend your path to include it.

answered Aug 20, 2013 at 21:51
Sign up to request clarification or add additional context in comments.

Comments

0

on Windows you can type echo %%PATH%% at the command prompt. It will give you at list of all the directories the shell search for programs to run. By default Python 3.3 will be installed on C:\Python33.

answered Aug 20, 2013 at 22:14

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.