question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

elfi.Prior and NoneType error

See original GitHub issue

Summary:

The first line in the quickstart tutorial throws an error on my system. Not entirely sure what I’m doing wrong. Thanks in advance for the help!

Reproducible Steps:

The following reproduces my error.

import elfi
elfi.Prior('uniform', -2, 4)

Current Output:

The current error is pasted here:

>>> mu = elfi.Prior('uniform', -2, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/Library/Python/3.6/lib/python/site-packages/elfi/model/elfi_model.py", line 676, in __init__
    super(Prior, self).__init__(distribution, *params, size=size, **kwargs)
  File "~/Library/Python/3.6/lib/python/site-packages/elfi/model/elfi_model.py", line 595, in __init__
    super(RandomVariable, self).__init__(*params, state=state, **kwargs)
  File "~/Library/Python/3.6/lib/python/site-packages/elfi/model/elfi_model.py", line 531, in __init__
    super(StochasticMixin, self).__init__(*parents, state=state, **kwargs)
  File "~/Library/Python/3.6/lib/python/site-packages/elfi/model/elfi_model.py", line 345, in __init__
    name = self._give_name(name, model)
  File "~/Library/Python/3.6/lib/python/site-packages/elfi/model/elfi_model.py", line 472, in _give_name
    while re.match('\s*super\(', info.code_context[0]):
TypeError: 'NoneType' object is not subscriptable

ELFI Version:

>>> import elfi; elfi.__version__
'0.6.0'
>>> import numpy; numpy.__version__
'1.13.1'
>>> import scipy; scipy.__version__
'0.19.1'

Python Version:

$ python3 --version
Python 3.6.1

Operating System:

Mac OS 10.12.5

$ sw_vers -productVersion 
10.12.5

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kskytencommented, Jul 12, 2017

Does mu = elfi.Prior('uniform', -2, 4, name='mu') work for you?

0reactions
jlintusaaricommented, Jul 21, 2017

This has now been fixed in ELFI version 0.6.1 released today. When automatic naming cannot be done, ELFI will assign a random name unless the name argument is given.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does a "Nonetype" object error on the public VQGA code ...
It's because in that input imagen_inicial is None . To fix it you should add another elif : if imagen_inicial == "None": imagen_inicial ......
Read more >
Solved: Having an issue where the 'NoneType' object error
Having an issue where the 'NoneType' object error is either not subscriptable or iterable when using list comprehension or list in general?
Read more >
How to Fix TypeError in Python: NoneType Object Is Not Iterable
The Python TypeError: NoneType Object Is Not Iterable error can be avoided by checking if a value is None or not before iterating...
Read more >
API — ELFI 0.8.4 documentation
A parameter node of an ELFI graph. Initialize a Prior. Parameters: distribution (str, object) – Any distribution from scipy.
Read more >
Typeerror nonetype object is not iterable : Complete Solution
Well, We before starting this section. Let's replicate this error in a very easy way. ... Since my_list is of NoneType class hence...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found