0

So I was running a flask-based web app on my local machine and everything was going just fine. Then, I mistakenly run a setup script which I've previously created within my app folder. And now my server wouldn't run and my cmd displays the error on the title. Here is the setup script that I ran mistakenly:

from setuptools import setup

setup(name='CodeX',
version='1.0',
description='CodeX lang&code',
author='',
author_email='',
url='127.0.0.1:5000/',
install_requires=['flask','flask-login','sqlalchemy','flask-sqlalchemy'])

And here is the full error message:

* Serving Flask app "webx.app"
* Forcing debug mode on
* Restarting with stat
File "C:\Python36\Scripts\flask.exe", line 1
SyntaxError: Non-UTF-8 code starting with '\x90' in file C:\Python36\Scripts\flask.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Is there a way to fix the error without having to uninstall and reinstall Flask?

Murphy Adam
  • 700
  • 1
  • 10
  • 19
  • 1
    Have you checked this question ? [SyntaxError: Non-UTF-8 code starting with '\x90' in file C:\Python36\python.exe on line 1, but no encoding declared](https://stackoverflow.com/questions/47393026/syntaxerror-non-utf-8-code-starting-with-x90-in-file-c-python36-python-exe) – Mostafa Hussein Jul 07 '19 at 23:59
  • 1
    And this one too [SyntaxError: Non-UTF-8 code starting with '\x91'](https://stackoverflow.com/questions/23092176/syntaxerror-non-utf-8-code-starting-with-x91) – Mostafa Hussein Jul 08 '19 at 00:00
  • @Mostafa, Thank you, I have already seen that answer, but it couldn't help me fix the problem, I already checked the PYTHONPATH. – Murphy Adam Jul 08 '19 at 00:01
  • Have you tried to add `# coding=utf8` at the top of your file ? – Mostafa Hussein Jul 08 '19 at 00:02
  • @Mostafa, I have, but, unfortunately, it's not working. I just couldn't trace the issue. I've been searching online for a couple of hours and nothing has worked for me yet. – Murphy Adam Jul 08 '19 at 00:05
  • 1
    @Mostafa, I have replaced all the quotes in the setup script with double quotes and I rerun the setup script and it worked! so apparently it was becasue of quotes which looked like the ASCII quotes but which were not, they belonged outside ASCII encoding. – Murphy Adam Jul 08 '19 at 01:18

1 Answers1

1

I have replaced all the quotes in the setup script with double quotes (could be single quotes either) and I rerun the setup script and it worked! so apparently it was becasue of quotes which looked like the ASCII quotes but which were not, they belonged outside ASCII encoding. So, if anyone of you faces the same problem, that might work for you (especially if you have copy-pasted some code).

N.B: Though the quotes may look the same, try to encode them and see the difference.

Murphy Adam
  • 700
  • 1
  • 10
  • 19