Forum Discussion

vdburg's avatar
vdburg
Resolver I
8 years ago
Solved

python script error

Hi,

I can´t run any Python code. Whatever I do it returns always the same error. I have just loaded an Excel sheet with 4 rows and 2 columns of fake data (just years and revenue) and it doesn´t work. I have checked the python home directory path and it´s looks ok. 

 

This is the error:

 

Feedback Type:
Frown (Error)

Timestamp:
2018-08-29T09:12:41.2061639Z

Local Time:
2018-08-29T11:12:41.2061639+02:00

Session ID:
cc309951-aabe-413f-82df-64a896661474

Release:
August, 2018

Product Version:
2.61.5192.601 (18.08) (x64)

Error Message:
Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 6, in <module>
matplotlib.pyplot.figure(figsize=(3,75,3,52777777777778))
File "C:\Users\[email protected]\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 535, in figure
**kwargs)
File "C:\Users\[email protected]\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 45, in new_figure_manager
thisFig = FigureClass(*args, **kwargs)
File "C:\Users\[email protected]\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\figure.py", line 328, in __init__
self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
TypeError: from_bounds() takes 4 positional arguments but 6 were given


OS Version:
Microsoft Windows NT 6.1.7601 Service Pack 1 (x64 es-ES)

CLR Version:
4.6.1 or later [Release Number = 394271]

Peak Virtual Memory:
4.24 GB

Private Memory:
424 MB

Peak Working Set:
553 MB

IE Version:
11.0.9600.18816

User ID:
1f0ab8de-e5bb-46e1-b314-e7a260ff9ab1

Workbook Package Info:
1* - es-ES, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: True.

Telemetry Enabled:
True

Model Default Mode:
Import

Snapshot Trace Logs:
C:\Users\[email protected]\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot1313376215.zip

Performance Trace Logs:
C:\Users\[email protected]\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip

Enabled Preview Features:
PBI_canvasTooltips
PBI_PythonSupportEnabled

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_newFromWeb
PBI_SpanishLinguisticsEnabled
CustomConnectors
PBI_variationUIChange
PBI_showIncrementalRefreshPolicy
PBI_compositeModels
PBI_DB2DQ

Enabled DirectQuery Options:
PBI_DirectQuery_Unrestricted

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

Formulas:


section Section1;

shared Hoja1 = let
Source = Excel.Workbook(File.Contents("\\Filer-1\users\rvanderburg\test_Python_power_BI.xlsx"), null, true),
Hoja1_Sheet = Source{[Item="Hoja1",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Hoja1_Sheet, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Year", type text}, {"Revenue", Int64.Type}})
in
#"Changed Type";

 

 

EDIT 31/08/2018:

Found already posted issue here:

https://community.powerbi.com/t5/Issues/Bug-in-python-visual/idi-p/487259/page/2#comments

 

7 Replies

  • Power BI team fixed the problem

    • Mardin's avatar
      Mardin
      Advocate IV

      Hi vdburg what did they actually fix? I have just started playing around with Python in PowerBI and I am getting the same error messages. How does one fix this?

      • vdburg's avatar
        vdburg
        Resolver I

        Hi Mardin,

        Have you updated to the last Power Bi desktop?

        This is a screenshot of how I see it with some simple made up data

         

         

        Maybe you can test if you load a table like the one I have here and use the same code.

         

        import matplotlib.pyplot as plt
        plt.bar(dataset.Year, dataset.Revenue)
        plt.show()

         

  • ryim2009's avatar
    ryim2009
    Regular Visitor

    I think the main issue is here in the error message...

    TypeError: from_bounds() takes 4 positional arguments but 6 were given

     

    The line that Python was trying to execute was this:

    self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)

     

    Maybe get rid of the 0's?

    Are you trying to make a visual or uploading data using python script?

    Have you tested out the code in an IDE?

     

    • vdburg's avatar
      vdburg
      Resolver I

      Hi,

      I just loaded a simple excel file with a small table to discard any problem coming from the data. It´s just this table

       

      YearRevenue
      2010100000
      2011200000
      2012300000
      2013400000
      2014500000

       

      I am trying to make a visual. I am just running this code:

      import matplotlib.pyplot as plt
      plt.bar(dataset.Year, dataset.Revenue)

      And this works in any other IDE

       

      or just running dataset to see the table. Or any other simple code it always returns the same error.

       

       

  • It seems that Power BI is inserting comma into figsize matplot function. (see below)

     

    matplotlib.pyplot.figure(figsize=(3,75,3,52777777777778))

     

    Rgds