omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    list() object not callable 3.5

    Pythonista
    2
    3
    3497
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jeff
      jeff last edited by

      Quick question:

      The list() function to turn strings/tuples into a list does not seem to work in pythonista with 3.5. I get the error: “‘list’ object is not callable. But run the same script in 2.7 it works. Googling around I didn’t find anything to indicate that list has depreciated.

      Here’s an example:
      myarray = list('1abcdefg')
      print(myarray)

      It works in 2.7 but not 3.5. Anyone have an idea on how to convert to a list in pythonista 3.5? Thanks!

      1 Reply Last reply Reply Quote 0
      • dgelessus
        dgelessus last edited by

        The error message means that you are trying to call a list object, and not the list class. This usually happens when you accidentally store a list under the variable name list, like list = [1, 2, 3], which hides Python's standard list class. To check if that's the issue, type list in the console to show the current value of the list variable. By default it will be <class 'list'>, but if you overwrote it, you'll get something like [1, 2, 3].

        To fix this, run del list, this removes your own list variable and makes the built-in list visible again. Or simply restart Pythonista.

        1 Reply Last reply Reply Quote 0
        • jeff
          jeff last edited by

          I appreciate your answer! Force closing and restarting did the trick. I’ve been downloading tutorial scripts and things from online to help me learn UI module better and I must of have found one that goofed it up. I didn’t realize it would overwrite it from one script to another. Anyway, again, thanks! Cheers!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors