cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
pbertens Regular Visitor
Regular Visitor

Can't run any Python script

Hello,

I'm trying to add a Python visual in a report. After adding a fake value to the python viz, I wrote the following script

matplotlib.pyplot.plot([1,2,3,4], [5,6,7,8])
matplotlib.pyplot.ylabel('Some numberts')
matplotlib.pyplot.show()

But everytime the following error pops up.

 

 

error Python-PBI.JPG

What goes wrong? Is it the fact that a comma "," is the standard for a decimal on my system in stead of a point "."?

kind regards,

Paul

1 ACCEPTED SOLUTION

Accepted Solutions
pbertens Regular Visitor
Regular Visitor

Re: Can't run any Python script

@

Hi Dale,

I've found out what the problem is and there is a work-around. I have a Dutch version of Windows. Comma-decimal is standard on my system. In the settings i've chaged it to point-decimal. But it would be nice if the python-visual works the same as the R-visual. When I use the R-visual I don't have the problem with comma- or point decima.

 

The error that I have is in row 6 of the script. And that is a row that python automatically generates when I open the python-visual.

I use the latest version of anaconda.

 

Regards,

Paul 

View solution in original post

7 REPLIES 7
Moof Frequent Visitor
Frequent Visitor

Re: Can't run any Python script

In Python, a comma separates arguments in a list of arguments. Float literals are always written with a decimal point.

 

In this case you are sending figsize = (4, ERROR, 3, 78427344733141)

 

In this case I am saying ERROR because number literals in python that begin with 0 should be expressed in octal (base 😎 and the two 8s in the number make it an invalid literal, which is what the compiler is complaining about.

 

You need to rewrite that with decimal points.

 

If you need to conver between decimal commas and decimal points, have a look at the locale module in python.

 

pbertens Regular Visitor
Regular Visitor

Re: Can't run any Python script

The problem is that I can't change that part of script. It's something within the Python visual. I think it's a bug in Power BI. Do you (or anyone else) know where I can address this bug?

Thanks,

Paul

pbertens Regular Visitor
Regular Visitor

Can't run any Python script

I work on a dutch version of Windows 7. We use comma decimals in stead of point decimals.  This gives me the following error when I run a very simple python script in the PBI Python visual:

error Python-PBI.JPG

 

I also posted this issue on the desktop forum (see Forum-topic).

 

I think it's a bug, because when I use the R-visual in power bi I don't have the issue with comma decimals, because the R-visual uses standard the point decimal.

 

I hope this is the correct place to address this kind of issues/bugs.

 

regards,

Paul

datafitters Frequent Visitor
Frequent Visitor

Re: Can't run any Python script

had the same issue. a temporary fix is to change the windows settings to . (dot) as a decimal-symbol and , (comma) as a thousand separator

Microsoft v-jiascu-msft
Microsoft

Re: Can't run any Python script

Hi Paul,

 

Everything seems fine.

1 Can you share your file?

2 What's the version of Python?

Can_t_run_any_Python_script

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
pbertens Regular Visitor
Regular Visitor

Re: Can't run any Python script

@

Hi Dale,

I've found out what the problem is and there is a work-around. I have a Dutch version of Windows. Comma-decimal is standard on my system. In the settings i've chaged it to point-decimal. But it would be nice if the python-visual works the same as the R-visual. When I use the R-visual I don't have the problem with comma- or point decima.

 

The error that I have is in row 6 of the script. And that is a row that python automatically generates when I open the python-visual.

I use the latest version of anaconda.

 

Regards,

Paul 

View solution in original post

McCow Member
Member

Re: Can't run any Python script

Hi all!

 

The another possible solution (workaround) is to change in function figManager parametr figsize.

Try 

figsize=rcParams['figure.figsize']

instead

figsize=figsize

 

figManager = new_figure_manager(num, 
figsize=rcParams['figure.figsize'],
#figsize=figsize,
dpi=dpi,
facecolor=facecolor,
edgecolor=edgecolor,
frameon=frameon,
FigureClass=FigureClass,
**kwargs)

in the pyplot.py
In actual version of  Anaconda strings 542-549 

 

Best regards,

Yuri

 

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)