[Tutor] ImportError: attempted relative import with no known parent package
adityakarthik9 at gmail.com
adityakarthik9 at gmail.com
Wed Jul 14 00:06:23 EDT 2021
> Hi.
>
>
>
> I am trying to execute a dump file using a .py file.
>
>
>
> I am using ubuntu for my projects.
>
>
>
> The command I give in the ubuntu terminal is :
>
>
>
> python3 main.py file.dump
>
I am pointing to the path:
".local/lib/python3/packages/notebook/riscv-newop"
Inside "riscv-newop" directory, there is a file "rvnewop" which consists
of main.py which I am trying to execute on my dump file which is also
inside the same folder rvnewop.
>
>
> When I type this command, I get an error stating that:
>
>
>
> File "main.py", line 3, in
>
> from .Histogram import Histogram
>
>
>
> ImportError: attempted relative import with no known parent package
>
>
>
> I am trying to plot histogram for my dump file. So the output of
this
> command should give me the frequency with which an assembly
instruction is
> repeated in the dump file.
>
> I am using the program from the following link to get the results.
>
> https://github.com/riscv-newop/riscv-newop/tree/master/rvnewop
>
> From my understanding, the error is occurring due to some directory
> mis-match but I made sure that all the files are in the same
directory.
If I use the below command:
python3 -m rvnewop path/to/file.dump
I think it should work but the rvnewop folder consists of many .py files.
I do not want the output for all of the files. I am only trying to execute
the main.py file which imports the Histogram.py file both of which are
inside the rvnewop folder.
My only doubt is : What directory should I be pointing to when I execute
the command:
python3 -m rvnewop path/to/file.dump
And how to get the results only with main.py for my dump file without
getting the error which is mentioned above .
Thank You
>
Sent from [1]Mail for Windows 10
References
Visible links
1. https://go.microsoft.com/fwlink/?LinkId=550986
More information about the Tutor
mailing list