Off topic:New To Python And Putty: Help!
1
0
Entering edit mode
12.0 years ago
Yasmine • 0

Can someone explain to me how to test the program that I am writing in my command line? For example, I have to create a program that takes two or three parameters (an optional first parameter) and I am trying to create error messages for those who will be using the program but when I put in my parameters I don't get any message.

For example..

My program should print an error message and quit if: the inputfile does not end with .genes the outputfile does not end with .fa or .fasta

I have written in wings...

def extractGenes(variable,input,output):
        variable = False
        if '-s' in sys.argv[1]:
                variable = True
        if not input.endswith(".genes"):
                print("Incorrect file type.")
                sys.exit(1)
        if not output.endswith(".fa") or output.endswith(".fasta"):
                print("Incorrect file type.")
                sys.exit(1)

I think this should work? but when I go to the putty command line to test it by writing python extractGenes.py (myinputfile) (myoutputfile), nothing happens.

python • 6.7k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 1981 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6