Joe Rakhimov
Joe Rakhimov

Reputation: 5083

Python - How to get more info about SyntaxError?

I am trying to run Python code on Ubuntu image container with all required libraries.

Bootstrap: docker
From: ubuntu

%post
apt-get -y update
apt-get -y install python python3-pip curl
pip3 install scikit-learn cython numpy pydot keras torch torchvision
pip3 install matplotlib pandas plotly nltk seaborn scrapy gensim tensorflow xgboost textblob
pip3 install gym kaggle-environments stable-baselines3

I am running code in command line. When I run simple Hello World code, it works.

cat hello.py | singularity exec connectx.simg  /usr/bin/python

Hello World!

But when I try to run another script which requires various libraries, I am getting SyntaxError:

cat training3.py | singularity exec connectx.simg  /usr/bin/python
  File "<stdin>", line 26
    def __init__(self, observation_space: gym.spaces.Box, features_dim: int = 512):
                                        ^
SyntaxError: invalid syntax

It is not clear to me what is causing the SyntaxError. How can I get more info about this error?

Upvotes: 1

Views: 226

Answers (1)

Sambarilove
Sambarilove

Reputation: 123

try this instead:

cat training3.py | singularity exec connectx.simg  /usr/bin/python3

Upvotes: 1

Related Questions