Config Router

  • Google Sheets
  • CCNA Online training
    • CCNA
  • CISCO Lab Guides
    • CCNA Security Lab Manual With Solutions
    • CCNP Route Lab Manual with Solutions
    • CCNP Switch Lab Manual with Solutions
  • Juniper
  • Linux
  • DevOps Tutorials
  • Python Array
You are here: Home / main loop ‘builtin_function_or_method’ object is not iterable

main loop ‘builtin_function_or_method’ object is not iterable

August 1, 2021 by James Palmer

Direct Answer
In the code here:
saveFile = open(saveFileLine,’a’)
sourceCode = urllib2.urlopen(urlToVisit).read()
splitSource = sourceCode.split

change sourceCode.split to sourceCode.split().

If you want to know more about this error, read below:
When debugging, you’d better remove the try…except block, especially an “expect Exception” block, which is so generic that you will get lost about what is going wrong.
When removed the try…except block and run these code again, you will get error info like this:
—————————————————————————
TypeError Traceback (most recent call last)
in ()
43
44 for eachStock in stocksToPull:
—> 45 pullData(eachStock)

in pullData(stock)
23 splitSource = sourceCode.split
24
—> 25 for eachLine in splitSource:
26 splitLine = eachLine.split(‘,’)
27 if len(splitLine) ==6:

TypeError: ‘builtin_function_or_method’ object is not iterable

The error message TypeError: ‘builtin_function_or_method’ object is not iterable is associated with line 25, which means splitSource is a builtin_function_or_method and is not iterable.
What is splitSource? It is sourceCode.split. Here comes the answer. You should call a method by using (), without which you will get the method itself. The method str.split is obviously not iterable!

Related

Filed Under: Uncategorized

Recent Posts

  • How do I give user access to Jenkins?
  • What is docker volume command?
  • What is the date format in Unix?
  • What is the difference between ARG and ENV Docker?
  • What is rsync command Linux?
  • How to Add Music to Snapchat 2021 Android? | How to Search, Add, Share Songs on Snapchat Story?
  • How to Enable Snapchat Notifications for Android & iPhone? | Steps to Turn on Snapchat Bitmoji Notification
  • Easy Methods to Fix Snapchat Camera Not Working Black Screen Issue | Reasons & Troubleshooting Tips to Solve Snapchat Camera Problems
  • Detailed Procedure for How to Update Snapchat on iOS 14 for Free
  • What is Snapchat Spotlight Feature? How to Make a Spotlight on Snapchat?
  • Snapchat Hack Tutorial 2021: Can I hack a Snapchat Account without them knowing?

Copyright © 2025 · News Pro Theme on Genesis Framework · WordPress · Log in