Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
vdburg
Resolver I
Resolver I

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\rvanderburg@u.es\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 535, in figure
**kwargs)
File "C:\Users\rvanderburg@u.es\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\rvanderburg@u.es\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\rvanderburg@u.es\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot1313376215.zip

Performance Trace Logs:
C:\Users\rvanderburg@u.es\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

 

1 ACCEPTED SOLUTION
vdburg
Resolver I
Resolver I

Power BI team fixed the problem

View solution in original post

7 REPLIES 7
vdburg
Resolver I
Resolver I

Power BI team fixed the problem

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?

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

 

Captura_Pyhton.JPG

 

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()

 

I see.. We are still running August unfortunately since we have an external service prodivder pushing the Power BI updates on the company PCs. They only check for the update once a month and since September release came later than usual we will only get the update through the next roll out in October.

rdauanny
New Member

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

 

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

 

Rgds

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?

 

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.

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.