Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Traceback error
#1
I'm trying to import a class into another Python file. The previous example I have for this is something that Larz60+ built for me but he didn't set it up this way.

In any event, this is what I'm faced with in the example I'm trying to learn.

This is the class I've made called "Students.py:

class student:

    def__init__(self, name, major, GPA, is_on_probation):
        self.name = name
        self.major = major
        self.GPA = GPA
        self.is_on_probation = is_on_probation
This is where we import it:

from Students import Students

student1 = Student("Jim", "Business", 3.1, False)

print(student1)
This is the error:

Error:
C:\Python365\python.exe F:/USERS/Tonya/Python/Draft/App.py Traceback (most recent call last): File "F:/USERS/Tonya/Python/Draft/App.py", line 1, in <module> from Students import Students File "F:\USERS\Tonya\Python\Draft\Students.py", line 3 def__init__(self, name, major, GPA, is_on_probation): ^ SyntaxError: invalid syntax Process finished with exit code 1
As always - any help you can provide is most appreciated!
Reply


Messages In This Thread
Traceback error - by tjnichols - Sep-26-2018, 12:51 PM
RE: Traceback error - by ThiefOfTime - Sep-26-2018, 01:02 PM
RE: Traceback error - by tjnichols - Sep-26-2018, 02:40 PM
RE: Traceback error - by ichabod801 - Sep-26-2018, 04:38 PM
RE: Traceback error - by ThiefOfTime - Sep-26-2018, 04:56 PM
RE: Traceback error - by tjnichols - Sep-26-2018, 05:10 PM
RE: Traceback error - by ThiefOfTime - Sep-26-2018, 06:02 PM
RE: Traceback error - by tjnichols - Sep-26-2018, 07:13 PM
RE: Traceback error - by ThiefOfTime - Sep-26-2018, 08:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Traceback error tjnichols 3 2,647 Sep-25-2018, 07:24 AM
Last Post: wavic

Forum Jump:

User Panel Messages

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