Python Forum
Import Error for Templates
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import Error for Templates
#1
import numpy as np
    from statistics import mean
    x=[1,2,3,4,5]
    y=[6,7,8,9,10]
    m=((mean(x)*mean(y)-mean(x*y))/(mean(x)**2)-(mean(x**2)))
    print(m)
In the above the(or any other code where I run numpy), Firstly I am getting an input request when running the program. Something like this:
PS D:\Codes\Python> python practice.py
    Enter no.: 1
    Enter: 1

which should not happen as values are initialized. I saw in other forums regarding how the file should not be named after a Python module(which you can see, it isn't). Even after that I'm getting error:

"C:\Users\KIIT\AppData\Local\Programs\Python\Python36\lib\logging\__init__.py", line 28, in <module>
        from string import Template
    ImportError: cannot import name 'Template'
Can someone please tell me what to do about it?
Edit:
This problem is only powershell centric. The problem is faced when I run program through powershell. It works fine in IDLE.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  trax import error dhrsethi1 0 476 Dec-08-2023, 11:13 AM
Last Post: dhrsethi1
  Error when import Keras Azadfalah 1 2,754 Apr-29-2020, 04:45 AM
Last Post: buran
  DOWNLOAD DACTILAR FOOTPRINT SENSOR TEMPLATES jorge29 0 1,512 Jul-02-2019, 12:18 AM
Last Post: jorge29
  Python import tensorflow error owenhe 7 6,996 Jun-23-2018, 12:41 PM
Last Post: gontajones
  Different templates for different rectangles python Akhou 0 1,911 May-03-2018, 01:57 PM
Last Post: Akhou

Forum Jump:

User Panel Messages

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