unlisted_Netlify breaks .py scripts

Hi,

I am trying to use netlify as host for my pythonlabs project (doing python stuff in browser, client side via brython), however:
It simply breaks my python code by appending a line just containing: ;
Which makes my script fail with “syntax error”.
Also netlify adds an .js extension to the python script, instead of using the .py extension.
So, how to prevent netlify from modifying .py files?
Here is the site that breaks for that reason: https://pythonlabs.netlify.com/console.html
Looks into your browsers console and you’ll see the problem!

Tuxifan

I fixed it by issuing a rebuild

Hi, @niansa, and welcome to our Netlify community site. Thanks for sharing the solution.

Netlify doesn’t modify files or filenames (including file extensions). Our systems run the build command (if any) and then publish the files exactly as they are (unless post processing is enabled and even then only whitespaces should change).

So, if you happen to know the root cause was and have time to follow-up, it would be interesting to understand what occurred.

Hi

The cause was having enabled javascript optimisation.
It looks like it detects .py files as javascript, which isn’t that great.

Weird to hear that. Could you please link to the deploy where that happened and mention a python file there that was mishandled so we can get a bug filed?

Here it is:
https://condescending-feynman-b5ec1f.netlify.com/console
Look into the browser console and you’ll see a syntax error. There should be a script tag in body that loads the file that gets corrupted by netlify.
The script tag points to https://d33wubrfki0l68.cloudfront.net/js/6845f30d98a5797aac4bea6bba9867520ad61f92/console.py
The problem is the ; at the end of the file.
This is how the file should look like:
https://pythonlabs.netlify.com/console.py

I hope it helps.

It does help! Thanks so much. I’ve gotten a bug filed for us.

1 Like

Is it solved? Can I delete the site?

Hi, @niansa. No, the issue itself is not fixed but, yes, please feel free to delete the site anytime.

The site did reproduce the issue which was important for us when filing the bug report. The bug report contains the instructions to reproduce the issue so the site itself is no longer required.

Thank you for creating that site and you can delete it anytime.

1 Like