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

Two create_chart errors that disappear when passing additional folder_id argument #61

Open
naterattner opened this issue Jun 7, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@naterattner
Copy link

🐛 Bug Report

Hello, I am getting two errors when calling create_chart. This very possibly could be my doing something wrong, though I am following the blog post example.

Here is what I am calling:
new_chart = dw.create_chart(title = "California's Recently Arrived Immigrants", chart_type = 'd3-bars-stacked', data = dw_data)

And these are the errors:
Error 1: Chart could not be created, check your authorization credentials (access token)

Error 2: UnboundLocalError: local variable 'chart_info' referenced before assignment. I see this error was also referenced in #10.

However, when I pass the folder_id argument for create_chart, these errors do not appear:

new_chart = dw.create_chart(title = "California's Recently Arrived Immigrants", chart_type = 'd3-bars-stacked', data = dw_data, folder_id='64489')

Response is: "New chart d3-bars-stacked created!"

When passing the folder_id argument, the chart does appear in my account, though it does not get created in the specified folder -- it lives in the Datawrapper dashboard under "My Charts."

I was able to create a chart with the Datawrapper API separately from this package though am also seeing some unexpected behavior with folders (can't always move charts to a folder by ID).

🔬 How To Reproduce

Steps to reproduce the behavior:

  1. Call create_chart with title, chart_type, and data arguments as done in this notebook.
  2. Call the same function and add a folder_id argument.

Code sample

See above.

Environment

  • OS: Windows 10
  • Python version: 3.8.8

Screenshots

Two error messages:
dw_error

No error messages:
dw_error_2

Chart is created, but in "My Charts," not in the folder specified in the folder_id argument:
dw_error_3

📈 Expected behavior

Would expect a new chart to be created in my Datawrapper account and appear in the specified folder ID.

📎 Additional context

Thanks for reading/looking!

@naterattner naterattner added the bug Something isn't working label Jun 7, 2021
@github-actions
Copy link

github-actions bot commented Jun 7, 2021

Hello @naterattner, thank you for your interest in our work!

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

@naterattner naterattner changed the title Two errors that disappear when passing additional argument Two create_chart errors that disappear when passing additional folder_id argument Jun 7, 2021
@zak04
Copy link

zak04 commented Jun 11, 2021

Hello
I am also seeing the same error reported after attempting the tutorial (and my own chart creation tests). I can also confirm that the workaround Nate suggested works.

@clemens-boisseree
Copy link

clemens-boisseree commented Jun 23, 2021

Same problem here:
new_chart = dw.create_chart(title = "California's Recently Arrived Immigrants", chart_type = 'd3-bars-stacked', data = daten, folder_id='52570')
gives me the following error message:

datawrapper/datawrapper.py", line 109, in create_chart
    self.add_data(chart_id=chart_info["id"], data=data)
UnboundLocalError: local variable 'chart_info' referenced before assignment

Plus: The Workaround doesn't seem to work anylonger either...

@elanals
Copy link
Contributor

elanals commented Jun 23, 2021

Hey @clemens-boisseree , the workaround should still work (it does for me). You might want to double-check that the folder id is correct. But if this is definitely still an issue email me in support and we'll see if we can figure it out :)

Also @chekos a pull request for the underlying bug.

-Elana (from Datawrapper support)

@clemens-boisseree
Copy link

Hi Elena,
thanks, you were absolutely right, shame on me, I used an wrong token...

@chekos chekos self-assigned this Jun 23, 2021
@chekos
Copy link
Owner

chekos commented Jun 23, 2021

HI @elanals thank you for the Pull Requests!

And apologies all! I somehow managed to miss all the github notifications regarding this.

I'll review the PR asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants