Skip to content Skip to sidebar Skip to footer

Attributeerror: 'module' Object Has No Attribute 'ascii_lowercase'

I'm having big troubles coding a program, I decided to make the program on different files, having one class on each file and now it gives me the following error File 'principal.p

Solution 1:

it seems you have a string.py file in your folder so the import string will in fact import your string.py because since it has the same name of a built-in module, that gonna replace it. So I recommend to change the name of your file like classes.py and rather use from classes import String

Also you make a class for your main program, it's not the way to make an entry point in Python.

That's better :

#!/usr/bin/env python
import dxf
import string
from classes import String
import linea
import plotting.plot
import matplotlib.pyplot
import numpy 
import dxfgrabber
import getpass
import os

def main():
    archivo=input('ingresa nombre del archivo : \n>>')
    #instaciamos objetos
    objdxf=dxf.Lectura(archivo)

    stringg=String()

    objdxf.Pdf2Dxf()
    linea1=objdxf.getDxf()
    lineas=linea.Lineas(linea1)
    start,end=lineas.grabLinea()
    startS=stringg.separar(start)
    endS=stringg.separar(end)
    startC=stringg.cortar(startS)
    endC=stringg.cortar(endS)

    plt=plot.Graph(startC,endC)

if __name__ == '__main__':
    main()

Note also that you should only import when needed, for example you use import string in your main code but you don't use it.

Post a Comment for "Attributeerror: 'module' Object Has No Attribute 'ascii_lowercase'"