Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 63 Insurance
- 536.4K On-Premises Infrastructure
- 138.3K Analytics Software
- 38.6K Application Development Software
- 5.8K Cloud Platform
- 109.5K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.3K Integration
- 41.6K Security Software
Python script erroring out with message IndentationError: expected an indented block

Hi,
I am creating a code in python to check the Garbage collection but its erroring out with the below error message as. Can anyone please help me out.
File "/u01/app/oracle/Middleware/user_projects/domains/base_domain/GC_check.py", line 11
free = int(server.getJVMRuntime().getHeapFreeCurrent())/(1024*1024)
^
IndentationError: expected an indented block
#!/usr/bin/env python
import shutil
import os
wlsUserID = java.lang.System.getenv('wlsUserID')
wlsPassword = java.lang.System.getenv('wlsPassword')
connect( url='t3://localhost:7010', adminServerName='AdminServer')
domainRuntime()
servers=domainRuntimeService.getServerRuntimes();
printf('#Java heap information for ')
for server in servers:
free = int(server.getJVMRuntime().getHeapFreeCurrent())/(1024*1024)
freePct = int(server.getJVMRuntime().getHeapFreePercent())
current = int(server.getJVMRuntime().getHeapSizeCurrent())/(1024*1024)
max = int(server.getJVMRuntime().getHeapSizeMax())/(1024*1024)
disconnect()
exit()
Thanks,
Anindya.
Answers
-
Can anyone please help out.
-
Hi,
Can anyone please suggest on this.
Thanks in advance.
Thanks,
Anindya.
-
Putting in an extra space or leaving one out where it is needed will surely generate an error message . Some common causes of this error include:
- Forgetting to indent the statements within a compound statement
- Forgetting to indent the statements of a user-defined function.
The error message IndentationError: expected an indented block would seem to indicate that you have an indentation error. It is probably caused by a mix of tabs and spaces . The indentation can be any consistent white space . It is recommended to use 4 spaces for indentation in Python, tabulation or a different number of spaces may work, but it is also known to cause trouble at times. Tabs are a bad idea because they may create different amount if spacing in different editors .