[Tutor] TypeError: argument of type 'NoneType' is not iterable

Alan Gauld alan.gauld at yahoo.co.uk
Wed Jul 14 09:51:55 EDT 2021


On 14/07/2021 14:11, Aditya Karthik wrote:
> I want to run the contents of a folder named rvnewop for my dump file
> file.dump
> 
> So i type this command in the terminal:
> 
> python3 -m rvnewop  path/to/file.dump
> 
> But then I get an error :

caveat: I haven't looked at the code, just the error message...

>     program = Histogram.parse(args.filename, args.isa)

Here it refers to args.isa

>   File
> "/home/aditya/.local/lib/python3.8/site-packages/riscv-newop/rvnewop/Histogram.py",
> line 10, in parse
>     program = Program(name=filename, isa=isa)

This passes  that value on...

>     self.rv = RV32(isa=isa)

and on...

> line 34, in __init__
>     if "32I" in isa:
> TypeError: argument of type 'NoneType' is not iterable

And then it gets tested and is None.

So it looks like the problem is the args.isa.
Where does that come from? args suggests the
command line argument...

> when i try to execute using my command, i point to the path:
> ./.local/lib/python3.8/site-packages/riscv-newop
> 
> whereas the files i am trying to access are from the
> path:/.local/lib/python3.8/site-packages/riscv-newop/rvnewop
> 
> But, i don't think you are supposed to cd into the package directory or
> include it in the python's search path in another way.

If it has been set up correctly then the path should be OK.

> Is it possible to run only a particular .py file for example main.py from
> the rvnewop folder instead of running the entire folder ?

It is, you just have to specify the full path,
but that doesn't look like how this package should be used.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list