Python Forum
importing module - not working
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
importing module - not working
#1
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...
Error:
Traceback (most recent call last): File "/Users/jdhamblett/Desktop/python_work/making_pizzas", line 1, in <module> import pizza ModuleNotFoundError: No module named 'pizza' [Finished in 0.4s with exit code 1] [cmd: ['python3', '-u', '/Users/jdhamblett/Desktop/python_work/making_pizzas']] [dir: /Users/jdhamblett/Desktop/python_work] [path: /Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin]
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!
Reply


Messages In This Thread
importing module - not working - by jdhamblett - Jun-22-2020, 07:00 PM
RE: importing module - not working - by menator01 - Jun-22-2020, 07:14 PM
RE: importing module - not working - by Gribouillis - Jun-22-2020, 07:29 PM
RE: importing module - not working - by jdhamblett - Jun-22-2020, 07:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  importing variables from module 8376459 1 308 Feb-18-2024, 02:24 PM
Last Post: deanhystad
  no module named 'docx' when importing docx MaartenRo 1 997 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  working with TLV module Object Jennifer_Jone 3 1,198 Mar-14-2023, 07:54 PM
Last Post: Jennifer_Jone
  Unsure why module is not working garynewport 0 790 Feb-15-2023, 03:21 PM
Last Post: garynewport
  My code displays too much output when importing class from a module lil_e 4 1,207 Oct-22-2022, 12:56 AM
Last Post: Larz60+
  Pandas module not working Hass 2 1,773 Apr-14-2022, 03:13 PM
Last Post: snippsat
  Importing module in jupyter Noteboook ajitnayak1987 0 1,774 Jun-04-2021, 12:26 PM
Last Post: ajitnayak1987
  ERROR: importing desired module mbgamer28 0 1,702 Apr-05-2021, 07:46 PM
Last Post: mbgamer28
  importing same python library in multiple custom module escape_freedom13 6 3,888 May-10-2020, 07:01 PM
Last Post: escape_freedom13
  Importing module from a package results in import error goghvv 2 2,432 Mar-27-2020, 07:13 PM
Last Post: goghvv

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020