简体   繁体   English

Python“ IndentationError:预期为缩进块”

[英]Python “IndentationError: expected an indented block”

I just downloaded my old project to a new computer, and I'm getting an Indentation Error where there wasn't one before. 我只是将旧项目下载到一台新计算机上,但出现了以前没有的缩进错误。

I originally created this on a Ubuntu computer, now I'm trying to run it on a Windows 10 computer. 我最初是在Ubuntu计算机上创建的,现在我正尝试在Windows 10计算机上运行。 It was created in 2.7 but we have updated it to python 3. I double checked that there are no tabs, only spaces, and I can't find any reason for an error. 它是在2.7中创建的,但我们已将其更新为python3。我再次检查了是否没有制表符,只有空格,并且找不到任何错误原因。

def get_dirs(self):
    """Return an AppDirs object for the relevant OS."""
    return appdirs.AppDirs('West Tower', 'Patch-n-Kev')

def get_dirs(self):
  ^
IndentationError: expected an indented block

sample program: 示例程序:

if err: #or something that might cause another error

def f():
    pass

f()

when i run: 当我跑步时:

def f():
      ^
IndentationError: expected an indented block

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM