Python Forum
Bringing two files together
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bringing two files together
#1
I have 2 files that I'm trying to join. I've tried this with the files below. I've also tried this with the files provided by the instructor - still no dice. I've set this up in a virtual environment so I would have more control in what was installed.

class A:
    def spam(self):
        print('A.spam')
from .a import A

class B(A)
    def bar(self):
        print('B.bar')
from .a import A
from .b import B
This is the error I get:

Error:
C:\Python365\python.exe C:/LearningEnv/LearningEnv/10/splitting_a_module_into_multiple_files/TJN_Splitting_Module/__init__.py Traceback (most recent call last): File "C:/LearningEnv/LearningEnv/10/splitting_a_module_into_multiple_files/TJN_Splitting_Module/__init__.py", line 2, in <module> from .a import A ModuleNotFoundError: No module named '__main__.a'; '__main__' is not a package Process finished with exit code 1
As always - your help is most appreciated!
Reply


Messages In This Thread
Bringing two files together - by tjnichols - Oct-12-2018, 11:49 AM
RE: Bringing two files together - by ThiefOfTime - Oct-12-2018, 12:05 PM
RE: Bringing two files together - by tjnichols - Oct-12-2018, 02:21 PM
RE: Bringing two files together - by nilamo - Oct-12-2018, 03:27 PM
RE: Bringing two files together - by Larz60+ - Oct-12-2018, 03:24 PM
RE: Bringing two files together - by tjnichols - Oct-12-2018, 03:55 PM
RE: Bringing two files together - by tjnichols - Oct-12-2018, 04:57 PM
RE: Bringing two files together - by nilamo - Oct-12-2018, 05:29 PM
RE: Bringing two files together - by Larz60+ - Oct-12-2018, 08:42 PM

Forum Jump:

User Panel Messages

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