Stack Exchange
Why did I get SyntaxError: invalid syntax when importing GoogleStockDataExtract from google_screener_data_extract
I was wondering why I couldn't import GoogleStockDataExtract from google_screener_data_extract. Appreciate any help or suggestion. Below are the steps.

Do the installation in conda:

pip install google_screener_data_extract


Run code in Spyder:

from google_screener_data_extract import GoogleStockDataExtract


Got the error message:

from google_screener_data_extract import GoogleStockDataExtract
Traceback (most recent call last):

  File "C:\Users\voyma\Anaconda3\envs\Python_ST\lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-27-aff6e099a353>", line 1, in <module>
    from google_screener_data_extract import GoogleStockDataExtract

  File "C:\Users\voyma\Anaconda3\envs\Python_ST\lib\site-packages\google_screener_data_extract\__init__.py", line 1, in <module>
    from .google_screener_data_extract import GoogleStockDataExtract

  File "C:\Users\voyma\Anaconda3\envs\Python_ST\lib\site-packages\google_screener_data_extract\google_screener_data_extract.py", line 158
    print hh.result_google_ext_df.head()
           ^
SyntaxError: invalid syntax


Are you using Python 3? You can determine if you are by the output of python --version
It looks like the google_screener_data_extract claims to be compatible with Python 3, but this line is not valid Python 3 code:
print hh.result_google_ext_df.head()

should be:
print(hh.result_google_ext_df.head())

This project hasn't had an update in 3 years, so your best bet is probably to fork it, make the changes and use your fork.

Yes, it is not compatible with my new env built on Python 3.7. I fixed the line of print as you indicated, then came out other issues. Thank you, Dustin!

No problem, please make sure to accept the answer if this works for you!
