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

data model visualization is broken #637

Closed
nhoening opened this issue Apr 13, 2023 · 1 comment · Fixed by #638
Closed

data model visualization is broken #637

nhoening opened this issue Apr 13, 2023 · 1 comment · Fixed by #638
Assignees
Labels
bug Something isn't working Data development
Milestone

Comments

@nhoening
Copy link
Contributor

The command make show-data-model seems to have stopped working - I suspect that a dependency upgrade has caused this, maybe in the PIL package. Error message is below.
Some debugging might be helpful.

I could get the image creation going by removing the command argument from Image.open(iostream).show(). I'd look up why this parameter is gone. Is this function now better at guessing how to show a plot? Maybe we should remove FALLBACK_VIEWER_CMD ....

Also make a changelog entry!

./flexmeasures/data/scripts/visualize_data_model.py --uml --dev
DEBUG is on
CREATING UML CODE DIAGRAM ...
Finding all the relevant mappers in our model...
Relevant tables: ['role', 'account', 'account_role', 'fm_user', 'data_source', 'latest_task_run', 'generic_asset_type', 'generic_asset', 'sensor', 'timed_belief', 'timed_value']
Relevant models: {'latesttaskrun': <class 'flexmeasures.data.models.task_runs.LatestTaskRun'>, 'datasource': <class 'flexmeasures.data.models.data_sources.DataSource'>, 'genericasset': <class 'flexmeasures.data.models.generic_assets.GenericAsset'>, 'genericassettype': <class 'flexmeasures.data.models.generic_assets.GenericAssetType'>, 'market': <class 'flexmeasures.data.models.markets.Market'>, 'markettype': <class 'flexmeasures.data.models.markets.MarketType'>, 'price': <class 'flexmeasures.data.models.markets.Price'>, 'sensor': <class 'flexmeasures.data.models.time_series.Sensor'>, 'timedbelief': <class 'flexmeasures.data.models.time_series.TimedBelief'>, 'asset': <class 'flexmeasures.data.models.assets.Asset'>, 'assettype': <class 'flexmeasures.data.models.assets.AssetType'>, 'power': <class 'flexmeasures.data.models.assets.Power'>, 'user': <class 'flexmeasures.data.models.user.User'>, 'annotation': <class 'flexmeasures.data.models.annotations.Annotation'>, 'weather': <class 'flexmeasures.data.models.weather.Weather'>, 'weathersensor': <class 'flexmeasures.data.models.weather.WeatherSensor'>, 'weathersensortype': <class 'flexmeasures.data.models.weather.WeatherSensorType'>, 'account': <class 'flexmeasures.data.models.user.Account'>, 'accountannotationrelationship': <class 'flexmeasures.data.models.annotations.AccountAnnotationRelationship'>, 'accountrole': <class 'flexmeasures.data.models.user.AccountRole'>, 'role': <class 'flexmeasures.data.models.user.Role'>, 'rolesaccounts': <class 'flexmeasures.data.models.user.RolesAccounts'>, 'rolesusers': <class 'flexmeasures.data.models.user.RolesUsers'>, 'sensorannotationrelationship': <class 'flexmeasures.data.models.annotations.SensorAnnotationRelationship'>}
Loading class LatestTaskRun ...
Loading class DataSource ...
Loading class GenericAsset ...
Loading class GenericAssetType ...
Loading class Sensor ...
Loading class TimedBelief ...
Loading class User ...
Loading class Account ...
Loading class AccountRole ...
Loading class Role ...
Creating diagram ...
Creating the pydot graph object...
Creating PNG stream ...
Showing image ...
(fallback viewer is gwenview)
Traceback (most recent call last):
  File "/home/nicolas/workspace/seita/flexmeasures/./flexmeasures/data/scripts/visualize_data_model.py", line 286, in <module>
    create_uml_pic(store=args.store, dev=args.dev)
  File "/home/nicolas/workspace/seita/flexmeasures/./flexmeasures/data/scripts/visualize_data_model.py", line 103, in wrapper
    return func(*args, **kwargs)
  File "/home/nicolas/workspace/seita/flexmeasures/./flexmeasures/data/scripts/visualize_data_model.py", line 195, in create_uml_pic
    show_image(graph, fb_viewer_command=FALLBACK_VIEWER_CMD)
  File "/home/nicolas/workspace/seita/flexmeasures/./flexmeasures/data/scripts/visualize_data_model.py", line 103, in wrapper
    return func(*args, **kwargs)
  File "/home/nicolas/workspace/seita/flexmeasures/./flexmeasures/data/scripts/visualize_data_model.py", line 224, in show_image
    Image.open(iostream).show(command=fb_viewer_command)
TypeError: show() got an unexpected keyword argument 'command'
@nhoening nhoening added Data development bug Something isn't working labels Apr 13, 2023
@nhoening
Copy link
Contributor Author

It seems indeed that PIL changed and now is making its own guess how to render an image on the various platforms, see here.

The UnixViewer and its various subclasses are how it gets decided on Linux, but they also have classes for Windows and Mac.

@nhoening nhoening self-assigned this Apr 13, 2023
@nhoening nhoening linked a pull request Apr 13, 2023 that will close this issue
@Flix6x Flix6x added this to the 0.13.0 milestone Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Data development
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants