Hi there! I have 2 python scripts which are main_menu.py and inputip.py.
The problem occurs when I press "enter" to be redirected to main_menu.py when my function finishes in iputip.py. The script does not allow me to redirect to main_menu.py instead it shows this error on the Windows command prompt:
Traceback (most recent call last):
File "C:\python\main_menu.py", line 32, in ?
execfile('C:\python\Inputip.py')
File "C:\python\Inputip.py", line 11, in ?
input ("\nSelect enter to proceed back to Main Menu\n")
File "<string>", line 0
^ SyntaxError: unexpected EOF while parsing
Here are my codes (main_menu.py):
def menu():
#print what options you have
print "Welcome to Simple Network Program"
print " "
print "Please enter a following option to proceed"
print " "
print "2) View Personal IP Address"
print " "
return input ("Select an Option here: ")
loop = 1
choice = 0
while loop == 1:
choice = menu()
if choice == 1:
execfile('Inputip.py')
elif choice == 5:
loop = 0
print "Thank you for using the Simple Network Program!"
The code (inputip.py):
#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
import socket
import os
print ("\n\n"+socket.gethostbyname(socket.gethostname()))
input ("\nSelect enter to proceed back to Main Menu\n")
execfile('C:\python\main_menu.py')
The error seems to be pointing to the execfile. Some advice on the codes would be great. Thanks!