Example `replace_data` no longer works

See original GitHub issue

I’m seeing the following error when using replace_data() using the latest version (0.6.21):

*** ValueError: `.target_part` property on _Relationship is undefined when target-mode is external

This appears to be reproducable by running the example code from https://python-pptx.readthedocs.io/en/latest/dev/analysis/cht-chart-data.html:

>>> chart_data = ChartData()
>>> chart_data.categories = 'Foobar', 'Barbaz', 'Bazfoo'
>>> chart_data.add_series('New Series 1', (5.6, 6.7, 7.8))
>>> chart_data.add_series('New Series 2', (2.3, 3.4, 4.5))
>>> chart_data.add_series('New Series 3', (8.9, 9.1, 1.2))
>>> chart.replace_data(chart_data)

*** ValueError: `.target_part` property on _Relationship is undefined when target-mode is external

Please advise. Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
scannycommented, Oct 5, 2021

Hmm, yes, in the last release I gave the load/save package module a good going over and I expect this is a consequence of that “tightening up”.

Theoretically the code could be elaborated to first check whether the chart-data Excel was linked and if so drop that link and then write the embedded Excel, which is effectively what I expect it did in prior versions. It’s kind of an edge case though. Your idea to update your template sounds like the right idea to me 😃

0reactions
smcphersoncommented, Oct 5, 2021

@scanny it appears the excel chart-data file is in fact linked (and a broken link at that). Looks like thats always been the case in the .pptx template I’m using. It never mattered because I replace the chart data in the template with data I want merged with the chart.

The interesting thing is this had been working in previous versions - only when I updated from 0.6.18 to 0.6.21 did this start erroring out.

In any event I can probably update my template to not include linked chart-data and that should likely resolve. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

replaceData() not working with shiny modules #359 - GitHub
Although dataTableProxy() seems to be working with shiny modules since #357, replaceData() does not. I am using DT_0.2.6. See example below.
Read more >
how to get replacedata to work - Google Groups
I have a datatable and I would like to sequentially replace columns in the data based on the user's input - each user...
Read more >
R Shiny, DT::replaceData in callModule not working
In an R Shiny application, I am trying to use DT::replaceData to update the data to show with current state (e.g. filtering) preserved....
Read more >
DataTable - Proxy Table... ReplaceData returning blank table!
My Values are being altered as required - but replacedata() in this instance doesn't work and returns a blank output - 0 matching...
Read more >
CharacterData.replaceData() - Web APIs | MDN
The replaceData() method of the CharacterData interface removes a certain number of characters of the existing text in a given CharacterData ...
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