Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Broken interpreter?
#1
Whenever i try to run a script through Python 3.8 it gives me the following output:
Output:
Please enter a string: (a)There is a total of 0 characters in the string. (b) (c) (d) (e) (f) (g) There are not seven characters in that string (h) (i) (j) (k) Traceback (most recent call last): File "lucky.py", line 4, in <module> import requests, sys, webbrowser, bs4 File "/usr/local/lib/python3.8/site-packages/requests/__init__.py", line 43, in <module> import urllib3 File "/usr/local/lib/python3.8/site-packages/urllib3/__init__.py", line 7, in <module> from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 3, in <module> import logging File "/usr/local/lib/python3.8/logging/__init__.py", line 28, in <module> from string import Template ImportError: cannot import name 'Template' from 'string' (/home/computer/First_Programs/string.py)
Can somebody please help me?
Reply
#2
Give your file an other name than string.py.
This will shadowing a built-in module string.
>>> import string
>>> 
>>> string.ascii_lowercase
'abcdefghijklmnopqrstuvwxyz'
So this import use a filled called string.py.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why is copying and pasting a block now broken? WagmoreBarkless 2 1,330 May-05-2022, 05:01 AM
Last Post: WagmoreBarkless
  Why is copying and pasting a block now broken? WagmoreBarkless 1 1,197 May-04-2022, 11:40 PM
Last Post: Larz60+
  BrokenPipeError: [Errno 32] Broken pipe throwaway34 6 8,938 May-06-2021, 05:39 AM
Last Post: throwaway34
  Python broken if moved to a different folder ecastrotns 3 2,370 Oct-26-2020, 10:53 PM
Last Post: ecastrotns
  STT: recognition connection failed: [Errno 32] Broken pipe GrahamBerends 0 4,967 Jul-18-2020, 11:00 PM
Last Post: GrahamBerends
  Python DateTime is broken 10OctNotOct10a1 8 4,647 Jan-03-2020, 07:54 AM
Last Post: snippsat
  String being broken up into single characters ammorgan 1 2,309 Dec-31-2018, 07:06 AM
Last Post: Gribouillis
  Speech (audio file, wav) to Text - Broken pipe Shobha 1 3,712 Nov-27-2018, 12:41 PM
Last Post: Larz60+
  SMTPLIB MIMEText HTML - Words being broken GaryK 2 3,715 Apr-16-2018, 04:08 PM
Last Post: GaryK
  broken if statement???? DarthTader 2 3,407 Sep-29-2017, 05:03 AM
Last Post: DarthTader

Forum Jump:

User Panel Messages

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