Python Forum
attribute error stumped on how to fix it.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
attribute error stumped on how to fix it.
#1
Hi, Im trying to run some code but i get :
line 6, in <module>
for line in employees.splitlines():
AttributeError: '_io.TextIOWrapper' object has no attribute 'splitlines'

confPack = open("confPack.txt", "r")
cPack = list()
for eachLine in confPack:
    cPack.append(eachLine)
employees = open("employees.txt", "r")
for line in employees.splitlines():
    Attendee = line.split(",") + ['','']
    surname = Attendee[0]
    firstName = Attendee[1]
    print("Attendee: " + surname + ", " + firstName)
    if Attendee[2] == "Y" and Attendee[3] != "Y":
        print("Pack/s: " + cPack[0])
    if Attendee[3] == "Y" and Attendee[2] != "Y":
        print("Pack/s: " + cPack[0])
    if Attendee[2] == "Y" and Attendee[3] == "Y":
        print("Pack/s: " + cPack[0] + ", " + cPack[1])
    if Attendee[2] == "" and Attendee[3] == "":
        print("Pack/s: No Packs received" )
any help is much apreciated.
Reply


Messages In This Thread
attribute error stumped on how to fix it. - by hank4eva - Aug-10-2020, 06:05 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error: audioio has no attribute 'AudioOut' netwrok 3 1,604 Oct-22-2023, 05:53 PM
Last Post: netwrok
  cx_oracle Error - AttributeError: 'function' object has no attribute 'cursor' birajdarmm 1 4,646 Apr-15-2023, 05:17 PM
Last Post: deanhystad
  Getting 'NoneType' object has no attribute 'find' error when WebScraping with BS Franky77 2 7,775 Aug-17-2021, 05:24 PM
Last Post: Franky77
  Attribute Error received not understood (Please Help) crocolicious 5 3,854 Jun-19-2021, 08:45 PM
Last Post: crocolicious
  error in scapy attribute 'haslayer' evilcode1 5 8,279 Mar-02-2021, 11:19 AM
Last Post: evilcode1
  Stumped by my own code (ratio & epoch-time calculation). MvGulik 2 2,914 Dec-30-2020, 12:04 AM
Last Post: MvGulik
  Really stumped now Milfredo 7 4,276 Sep-17-2020, 06:18 AM
Last Post: Milfredo
  Still Stumped Milfredo 2 2,774 Sep-02-2020, 07:48 AM
Last Post: Milfredo
  attribute error instead of correct output MaartenRo 2 2,846 Aug-28-2020, 10:22 AM
Last Post: Larz60+
  Attribute Error - trying to create a pixel array out of PNG files The_Sarco 1 2,597 Apr-29-2020, 07:10 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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