Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with imports when trying to run run-tests.py #17

Open
waynee95 opened this issue Feb 20, 2023 · 1 comment
Open

Issues with imports when trying to run run-tests.py #17

waynee95 opened this issue Feb 20, 2023 · 1 comment

Comments

@waynee95
Copy link

Running python3.11 run-tests.py leads to the following error:

Traceback (most recent call last):
  File "/home/waynee95/Documents/python-student-support-code/run-tests.py", line 6, in <module>
    from interp_x86.eval_x86 import interp_x86
  File "/home/waynee95/Documents/python-student-support-code/interp_x86/eval_x86.py", line 9, in <module>
    from convert_x86 import convert_program
ModuleNotFoundError: No module named 'convert_x86'

I am not too familiar with the module system of python but I tried to add a dot in the import, i.e. from .convert_x86 import convert_program, but this will then lead to another error:

Traceback (most recent call last):
  File "/home/waynee95/Documents/python-student-support-code/run-tests.py", line 6, in <module>
    from interp_x86.eval_x86 import interp_x86
  File "/home/waynee95/Documents/python-student-support-code/interp_x86/eval_x86.py", line 10, in <module>
    from parser_x86 import x86_parser, x86_parser_instrs
ModuleNotFoundError: No module named 'parser_x86'

This will continue.

@Ray-Eldath
Copy link

Same on my machine. The following patch should fix this:

diff --git a/interp_x86/eval_x86.py b/interp_x86/eval_x86.py
index d9e0146..a1a9b6a 100644
--- a/interp_x86/eval_x86.py
+++ b/interp_x86/eval_x86.py
@@ -6,8 +6,8 @@ from dataclasses import dataclass
 
 from utils import *
 
-from interp_x86.convert_x86 import convert_program
-from interp_x86.parser_x86 import x86_parser, x86_parser_instrs
+from convert_x86 import convert_program
+from parser_x86 import x86_parser, x86_parser_instrs
 
 
 def interp_x86(program):
diff --git a/utils.py b/utils.py
index 7a7557b..8185cc5 100644
--- a/utils.py
+++ b/utils.py
@@ -1182,7 +1182,7 @@ def compile_and_test(compiler, compiler_name,
                      program_filename):
     total_passes = 0
     successful_passes = 0
-    from interp_x86.eval_x86 import interp_x86
+    from eval_x86 import interp_x86
 
     program_root = os.path.splitext(program_filename)[0]
     with open(program_filename) as source:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants