SyntaxError:语法无效,没有任何理由吗?

时间:2019-04-19 01:14:29

标签: python syntax-error

我不理解该问题,我认为主要问题是“ if(”行中的括号 没有关闭。但是无论我在哪里尝试关闭它。我仍然遇到问题!

    if(
    self.proxy_address and int(self.proxy_port > 0) or \
     Settings.connection_type = "proxy" 
     self.aborting = False
    self.start_time = time.time()
    self.proxy_chrome_extension:
    # assign logger
    self.show_logs = show_logs
    Settings.show_logs = show_logs or None
    self.multi_logs = multi_logs
    self.logfolder = get_logfolder(self.username, self.multi_logs)
    self.logger = self.get_instapy_logger(self.show_logs)

这是我的错误日志

 File "c:\Users\refaa\.vscode\extensions\ms-python.python-2019.3.6558\pythonFiles\lib\python\ptvsd\__main__.py", line 272, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\Users\refaa\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\refaa\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\refaa\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\refaa\Desktop\instapy-quickstart-master\instapy-quickstart-master\quickstart.py", line 19, in <module>
    from instapy import InstaPy
  File "C:\Users\refaa\AppData\Local\Programs\Python\Python37\lib\site-packages\instapy\__init__.py", line 3, in <module>
    from .instapy import InstaPy
  File "C:\Users\refaa\AppData\Local\Programs\Python\Python37\lib\site-packages\instapy\instapy.py", line 279
    Settings.connection_type = "proxy"
                             ^
SyntaxError: invalid syntax
PS C:\Users\refaa\Desktop\instapy-quickstart-master\instapy-quickstart-master>

1 个答案:

答案 0 :(得分:0)

这对您有帮助吗?您还没有正确定义条件 self.proxy_chrome_extension:无效,我假设是条件条件还是变量赋值,

if (self.proxy_address and int(self.proxy_port > 0) or Settings.connection_type == "proxy"):
    self.aborting = False
    self.start_time = time.time()
    self.proxy_chrome_extension = None
    # assign logger
    self.show_logs = show_logs
    Settings.show_logs = show_logs or None
    self.multi_logs = multi_logs
    self.logfolder = get_logfolder(self.username, self.multi_logs)
    self.logger = self.get_instapy_logger(self.show_logs)

出于将来的考虑,请考虑使用像PyCharm这样的IDE来为您进行语法突出显示