Do you have tkinter installed? The graphics.py module needs it to run. On Sat, Aug 1, 2020 at 11:36 PM Sarvesh Poddar via Python-list < python-list@python.org> wrote:
> Hi, > I am currently using Python 3.8.5 with IDLE environment that comes > pre-installed with the Python application. I am using the book "An > Introduction to computer science" by John Zelle as my reference. > The problem I am facing is "There is a python program named "graphics.py" > that is used as reference in the book and I downloaded the python file from > internet (link to the file - > https://mcsp.wartburg.edu/zelle/python/graphics.py). I have kept this > module in (C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32) and > this is were my Python files also lie in C drive. The problem is that I am > not able to import graphics.py file and when I try to do that following is > the error I receive, > Traceback (most recent call last): > File "<pyshell#0>", line 1, in <module> import graphics > File > "C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", > line 1 > Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 > 32 bit (Intel)] on win32 ^SyntaxError: invalid syntax > I have installed, uninstalled and then re-installed Python 3.8.5 multiple > times but the problem remains. I did a thorough internet search and most of > them suggested using sys path and following is the result, > > import sys>>> sys.path['', > 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\idlelib', > 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip', > 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs', > 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib', > 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32', > 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages'] > When I write a different line - (from import graphics *), this is the > output: > from graphics import *Traceback (most recent call last): File > "<pyshell#3>", line 1, in <module> from graphics import * File > "C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", > line 1 Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC > v.1926 32 bit (Intel)] on win32 ^SyntaxError: invalid syntax > Please do let me know if I am missing out something very basic. > Thanks and I look forward. On Saturday, 1 August, 2020, 07:54:19 am > IST, boB Stepp <robertvst...@gmail.com> wrote: > > On Thu, Jul 30, 2020 at 9:24 AM Sarvesh Poddar via Python-list > <python-list@python.org> wrote: > > > I re-installed Python in my Windows system as the earlier one was not > able to import modules... > > You do not provide much detail to diagnose what your problem(s) > is(are). By the "earlier one" is it the same version as the one you > re-installed? Were you able to run IDLE with the "earlier one"? By > not being able to import modules do you mean modules from Python's > standard library? Or do you mean installing third party libraries > using pip? > > > ...But now I am not able to open IDLE after multiple tries. > > Have you looked in your start menu in the list of installed programs > for Python? If it is there did you expand it and see if there is an > entry for IDLE? How have you been trying (unsuccessfully) to open > IDLE? > > > -- > boB > > -- > https://mail.python.org/mailman/listinfo/python-list > -- **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars **** Bob van der Poel ** Wynndel, British Columbia, CANADA ** EMAIL: b...@mellowood.ca WWW: http://www.mellowood.ca -- https://mail.python.org/mailman/listinfo/python-list