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

TypeError when building the simplelife model #6

Closed
ro-co opened this issue Jun 25, 2019 · 7 comments

Comments

Projects
None yet
3 participants
@ro-co
Copy link

commented Jun 25, 2019

Hi,
Thanks for releasing this code. I am enjoying going through it and am learning a lot.
Whenever I follow the instructions on the website for "Building a Model" using the Spyder plugin I get an error. I have attempted to debug however I am only beginning to learn python and have not had much luck.
The error message is as below.

File "C:\Users\Local Administrator\Anaconda3\lib\site-packages\modelx\core\space.py", line 1237, in new_cells_from_excel

sig = "=None, ".join(cellstable.param_names) + "=None"

TypeError: sequence item 0: expected str instance, NoneType found

Thanks,
ro-co

@fumitoh

This comment has been minimized.

Copy link
Owner

commented Jun 25, 2019

What are the version numbers of modelx and lifelib?
You can check them by the following code.

>>> import modelx as mx

>>> mx.__version__

>>> import lifelib

>>> lifelib.__version__
@declann

This comment has been minimized.

Copy link

commented Jun 25, 2019

Hi,

I get the same error when I try to run the vanilla simplelife template (haven't tried others yet).

ModelX version 0.0.22 and lifelib 0.0.11.

Using the stack trace I noticed that some cell references in build_input.py didn't match up to valid tables in inputs.xlsx.

It appears that two inputs spreadsheets are packaged - the other one is input.xlsm (macro-enabled) - and the cell references appeared to match in this case - so the code appears to be configured for this one.

So, I backed up the xlsx and saved the macro-enabled file as input.xlsx (without macros) and now it appears to work fine. I guess you could alternatively point the code to input.xlsm

Perhaps Fumito can clarify the separate spreadsheets or if versions are a problem for us.

Cheers,
Declan

@fumitoh fumitoh changed the title Building the simplelife model TypeError when Building the simplelife model Jun 25, 2019

@fumitoh

This comment has been minimized.

Copy link
Owner

commented Jun 25, 2019

I couldn't reproduce the error. Note input.xlsm is renamed to input.xlsx in lifelib v0.0.11 and the positions of some tables in the files are adjusted as this commit: 41abc27

My guess is that you're using build_input.py from an older version of lifelib with input.xlsx.

@ro-co

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

Hi fumithoh,

Sorry I missed your response.
I ran the code and I am using lifelib 0.0.11

Using the fix Declan mentioned I got it running.
The problem was that the input.xlsx did not have the tab "otherparams" completely filled out. However input.xlsm did. The code in simpleplife.py links to input.xlsx.
I have attached the unmodified version of input.xlsm.

Thanks,
ro-co

input.xlsx

@declann

This comment has been minimized.

Copy link

commented Jul 5, 2019

I downloaded the lifelib archive (0.0.11) from https://pypi.org/project/lifelib/
to check if this is consistent with what's on my system and it isn't. We don't have the changes from the commit Fumitoh referenced.

This is odd because the version number is consistent. Here is the output of pip show lifelib

Name: lifelib
Version: 0.0.11
Summary: Actuarial models in Python
Home-page: https://lifelib.io
Author: Fumito Hamamura
Author-email: fumito.ham@gmail.com
License: License :: OSI Approved :: MIT License
Location: c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages
Requires: modelx
Required-by:

I tried uninstalling and reinstalling lifelib with --no-cache-dir. pip downloaded an archive from this url https://files.pythonhosted.org/packages/6e/1c/e31b6f029be1b6f21257a109b393cdd52adfcf5ff3eef00d9a953d66ec52/lifelib-0.0.11-py3-none-any.whl

When I open this in 7zip I can see its consistent with what was on my system and not with what is packaged on pypi.org

I will do a dev install from github to get around this, but it is a little odd behaviour from pip

@fumitoh

This comment has been minimized.

Copy link
Owner

commented Jul 5, 2019

I reproduced the problem. As declan pointed out, v0.0.11 was not packaged correctly, so both input.xlsx and input.xlsm are included, and the included build_input.py is not reflecting revisions up to v0.0.11 tag. As PyPI does not accept uploading the same version, I'll fix the issue at the next release.

@fumitoh fumitoh added this to the v0.0.12 milestone Jul 5, 2019

@fumitoh fumitoh added the bug label Jul 5, 2019

@fumitoh fumitoh self-assigned this Jul 5, 2019

@fumitoh fumitoh changed the title TypeError when Building the simplelife model TypeError when building the simplelife model Jul 5, 2019

@fumitoh

This comment has been minimized.

Copy link
Owner

commented Jul 6, 2019

Fixed in v0.0.12

@fumitoh fumitoh closed this Jul 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.