Running a .py file in python that requires input
Question: the question I have is really a simple one, and maybe the issue is just myself
not knowing the correct parameters for python with Linux.

The file I am running uses input from the operator both to run the program,
and also to get the information to convert, which I will place below:

    
    
        Initial_LonH = float(input("\nEnter RA's Hour >>> "));
        Initial_LonM = float(input("\nEnter RA's Minute >>> "));
        Initial_LonS = float(input("\nEnter Ra's Second >>> "));
        Initial_LatH = float(input("\nEnter Dec's Hour >>> "));
        Initial_LatM = float(input("\nEnter Dec's Minute >>> "));
        Initial_LatS = float(input("\nEnter Dec's Second >>> "));
    

The issue when I run this in python as "python GalaxyConverter.py, the
following error appears:

    
    
     Traceback (most recent call last):
       File "GalaxyConverter.py", line 105, in <module>
         input_Runner = str(input("\nDo you wish to convert Right Ascension and Declination into Cartesian?"
       File "<string>", line 1, in <module>
     NameError: name 'yes' is not defined
    

It seems the issue is that the file does not know to take the command I put
into the terminal as input for the python file. May I ask what I should do to
fix this?

The Entire Code is below:

    
    
    from math import radians, sin, cos, sqrt, asin, atan
    
    Minute_Con = 60;
    Second_Con = 3600;
    DT_Radians = 0.0174539252;
    RT_Degrees = 57.29577951;
    Radi_Verse = 879829141200000000000000;
    WRunner = True
    
    
    def HMS_Expand_Lon(LongitudeH, LongitudeM, LongitudeS):
        ##{
        print("\n The Right Ascension starts as " + str(LongitudeH) + ":" + str(LongitudeM) + "." + str(LongitudeS));
        LongitudeM = LongitudeM/Minute_Con;
        LongitudeS = LongitudeS/Second_Con;
        LongitudeHMS = LongitudeH + LongitudeM + LongitudeS;
        LongitudeHMS = LongitudeHMS * 15;
        print("\n The Right Ascension becomes " + str(LongitudeHMS));
        return LongitudeHMS
        ##}
    
    def HMS_Expand_Lat(LatitudeH, LatitudeM, LatitudeS):
        ##{
        print("\n The Declination starts as " + str(LatitudeH) + ":" + str(LatitudeM) + "." + str(LatitudeS));
        LatitudeM = LatitudeM/Minute_Con;
        LatitudeS = LatitudeS/Second_Con;
        LatitudeHMS = LatitudeH + LatitudeM + LatitudeS;
        LatitudeHMS = LatitudeHMS * 15;
        print("\n The Declination becomes " + str(LatitudeHMS));
        return LatitudeHMS
        ##}
    
    def HMS_Convert_Lon(LongitudeHMS):
        ##{
        LongitudeRAD = LongitudeHMS * DT_Radians;
        print("\n The Right Ascension becomes " + str(LongitudeRAD));
        return LongitudeRAD
        ##}
    
    def HMS_Convert_Lat(LatitudeHMS):
        ##{
        LatitudeRAD = LatitudeHMS * DT_Radians;
        print("\n The Declination becomes " + str(LatitudeRAD));
        return LatitudeRAD
        ##}
    
    def RAD_Convert_Lon(LongitudeRAD, LatitudeRAD):
        ##{
        Con_Lon = LongitudeRAD * LongitudeRAD;
        Con_Lat = LatitudeRAD * LatitudeRAD;
        Con_Lat_Lon = sqrt(Con_Lat + Con_Lon);
        print("\n The Right Ascension becomes " + str(Con_Lat_Lon));
        return Con_Lat_Lon
        ##}
    
    def RAD_Convert_Lat(LongitudeRAD, LatitudeRAD):
        ##{
        Con_Lon = LongitudeRAD;
        Con_Lat = LatitudeRAD;
        Con_Lon_Lat = atan(Con_Lon / Con_Lat);
        print("\n The Declination becomes " + str(Con_Lon_Lat));
        return Con_Lon_Lat
        ##}
    
    def POL_Convert_Lon(LongitudePOL, LatitudePOL):
        ##{
        POL_Lon = LongitudePOL * cos(LatitudePOL);
        DEG_Lon = POL_Lon * RT_Degrees;
        print("\n X finally becomes " + str(DEG_Lon));
        return DEG_Lon
        ##}
    
    def POL_Convert_Lat(LongitudePOL, LatitudePOL):
        ##{
        POL_Lat = LongitudePOL * sin(LatitudePOL);
        DEG_Lat = POL_Lat * RT_Degrees;
        print("\n Y finally becomes " + str(DEG_Lat));
        return DEG_Lat
        ##}
    
    def main():
        ##{
        Initial_LonH = float(input("\nEnter RA's Hour >>> "));
        Initial_LonM = float(input("\nEnter RA's Minute >>> "));
        Initial_LonS = float(input("\nEnter Ra's Second >>> "));
        Initial_LatH = float(input("\nEnter Dec's Hour >>> "));
        Initial_LatM = float(input("\nEnter Dec's Minute >>> "));
        Initial_LatS = float(input("\nEnter Dec's Second >>> "));
        Lon_Expanded = HMS_Expand_Lon(Initial_LonH, Initial_LonM, Initial_LonS);
        Lat_Expanded = HMS_Expand_Lat(Initial_LatH, Initial_LatM, Initial_LatS);
        Lon_Converted = HMS_Convert_Lon(Lon_Expanded);
        Lat_Converted = HMS_Convert_Lat(Lat_Expanded);
        Lon_RAD = RAD_Convert_Lon(Lon_Converted, Lat_Converted);
        Lat_RAD = RAD_Convert_Lat(Lon_Converted, Lat_Converted);
        Lon_POL = POL_Convert_Lon(Lon_RAD, Lat_RAD);
        Lat_POL = POL_Convert_Lat(Lon_RAD, Lat_RAD);
        X_Scaled = Lon_POL / Radi_Verse;
        Y_Scaled = Lat_POL / Radi_Verse;
        print("\n   To scale of the theoretical length of universe, X = " + str(X_Scaled));
        print("\n   To scale of the theoretical length of the universe, Y = " + str(Y_Scaled));
        ##}
    
    
    while WRunner == True:
        input_Runner = input("\nDo you wish to convert Right Ascension and Declination into Cartesian?"
                                 "\nif so, please type yes, if not, please type no >>> ");
        if input_Runner == "yes":
            main();
        if input_Runner != "yes":
            break
    


Answer: In python 3, you can just use `input` in your example, it can input strings.
But in python 2, the same function is `raw_input`.

`input` function in Python 2 is equals to `eval(raw_input(prompt))`, it will
evaluate input string as a Python expression.

Obviously your running python version is python 2, but I don't know what the
code's python version is. But you need to modify all `input` to `raw_input` if
it is python version is 2.

Ref:

<https://docs.python.org/2/library/functions.html#input>

<https://docs.python.org/3/library/functions.html#input>

