Hello Dennis, Sorry for my copy-paste error and thanks for highlighting the same. I will make sure that from next time I will maintain the line breaks. I tried opening it in CMD and it did open with the skewed triangle figure although I am still not able to use it in my IDLE environment. Unfortunately, I am not able to move ahead with my Python classes because of this, as it specifically asks to import the module before proceeding. I saved the file in tkinter folder now and receive the same problem, >>> import graphicsTraceback (most recent call last): File "<pyshell#3>", line >>> 1, in <module> import graphicsModuleNotFoundError: No module named >>> 'graphics' Location of the file - C:\Program Files (x86)\Lib\tkinter
Didn't work out. On Monday, 3 August, 2020, 12:47:26 am IST, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: On Sun, 2 Aug 2020 06:36:28 +0000 (UTC), Sarvesh Poddar via Python-list <python-list@python.org> declaimed the following: > 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, > In future, you might want to ensure your cut&paste and/or posting client, maintains line breaks -- many of your pastes seem to "unwrap" stuff... >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 ... such as the above, which appears to have turned something like 7 lines of output into one long string/paragraph. My only suggestion is to drop OUT of IDLE or whatever, and open a Windows command shell... and try running a script from that shell. I note that this library makes use of Tkinter -- which is also used by IDLE. The two uses may be causing complications. Going to a command shell avoids that. -=-=- C:\Users\Wulfraed\Downloads>type testgraphics.py import graphics print(dir(graphics)) C:\Users\Wulfraed\Downloads>python testgraphics.py ['BAD_OPTION', 'Circle', 'DEFAULT_CONFIG', 'Entry', 'GraphWin', 'GraphicsError', 'GraphicsObject', 'Image', 'Line', 'OBJ_ALREADY_DRAWN', 'Oval', 'Point', 'Polygon', 'Rectangle', 'Text', 'Transform', 'UNSUPPORTED_METHOD', '_BBox', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '__version__', '_root', '_update_lasttime', 'color_rgb', 'os', 'sys', 'test', 'time', 'tk', 'update'] C:\Users\Wulfraed\Downloads> -=-=- Heck... from the command shell, navigate to the directory in which you saved graphics.py and enter -=-=- C:\Users\Wulfraed\Downloads>python graphics.py -=-=- On my system, that pops up a small window with skewed triangle, some text, and a grey input field. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list