2016-09-08 4 views
0

내가 파이썬 파일에 대한 간단한 테스트에이 문제를 얻고,파이썬 들여 쓰기 오류 문제

class Prueba(object): 

    def __init__(self): 
     self.position = 0 


    def build_message(self, signal): 
     message = self.position 
     message = message | (0b1<<signal) 
     s = bin(message) 
     s = s[2:len(s)] 
     s = (16-len(s))*'0' + s 

     s0 = s[0:len(s)/2] 
     s1 = s[len(s)/2:len(s)] 
     s0 = s0[::-1] 
     s1 = s1[::-1] 
     s_final = int(s0 + s1, 2) 
     return s_final 

    def motor_activation(self): 
     rospy.logwarn("Preparing motor to start...") 
     if(self.drive_status[MC] == False and self.drive_status[READY] == False and self.drive_status[BRAKE] == False and self.drive_status[ERROR] == False): 
      rospy.sleep(1) 
      ####### Avtivate FG_R ####### 
      message = self.build_message(FG_R) 
      self.setBrModbusValue(2, message) 

      ##Wait a little 
      rospy.sleep(1) 

      ####### Avtivate FG_E ####### 
      message = self.build_message(FG_E) 
      self.setBrModbusValue(2, message) 

임 ipython 그것을 실행하려고 할 때이 메시지를 받고 :

message = self.position 
    ^
IdentationError:expected an indented block 
+0

로이 저장하려고하는 선에서? – snufsan

+1

notepad ++가 아닌 편집기로 코드를 편집 할 수 있습니까? 일부 설정이 수정되지 않으면 탭과 공백이 문제가됩니다. –

+1

탭과 스페이스가 혼합되어 있습니까? – Gogo

답변

0

이 필수 공백이 섞인 탭 문제.

사용중인 편집기의 일부 설정을 변경하여 모든 탭을 공백으로 변환 할 수 있습니다. 숭고한 텍스트의 경우

: 환경 설정 -> 설정 - 사용자

패키지/사용자/Preferences.sublime-설정

{ 
    "tab_size": 4, 
    "translate_tabs_to_spaces": true 
}