importing module - not working - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: importing module - not working (/thread-27810.html) |
importing module - not working - jdhamblett - Jun-22-2020 Hi all - Total Python beginner looking for some help. I looked all over for an answer with no luck... sorry for the total newbie question. I'm working my way through Eric Matthes' Python Crash Course book. Here's my code: import pizza pizza.make_pizza(16,'mushrooms')Here is the file pizza - which is in the same directory as making.pizza def make_pizza(size, *toppings): """ Summarize the pizza we are about to make """ print(f"\nMaking a {size}-inch pizza with the following toppings:") for topping in toppings: print(f"- {topping}")For some reason the import isn't working. Here's the error I'm getting... Is there a configuration setting I'm missing in Sublime Text (I couldn't get this to work on my terminal session either on my Mac). I'm running Python3 3.8.3.Thanks for the help! RE: importing module - not working - menator01 - Jun-22-2020 I'm not familiar with sublime but, maybe the path is not included with sublime. Check your paths. Check to see if will work in a shell. RE: importing module - not working - Gribouillis - Jun-22-2020 Your files don't seem to have the extension .py, this is probably the cause of the error. Rename the files pizza.py and making_pizzas.py
RE: importing module - not working - jdhamblett - Jun-22-2020 (Jun-22-2020, 07:29 PM)Gribouillis Wrote: Your files don't seem to have the extension .py, this is probably the cause of the error. Rename the files I'm an idiot... that was exactly it... I was assuming Sublime was saving everything with the .py extension. Ugh... thanks for the help... really appreciate it. |