• Drizzel

    The scene module comes natively with pythonista, and there are a few examples that might help

    posted in Pythonista read more
  • Drizzel

    Oh, and your last two lines should be:

    if __name__ == '__main__':
        main()
    

    This should be a working version:

    # coding: utf-8
    import twitter
    
    def main():
        accounts = twitter.get_all_accounts()
        if not accounts:
            print('No Twitter accounts were found. You can configure Twitter accounts in the settings app. If you have denied access to your accounts when prompted, you can also change your mind there.')
        account = accounts[0]
        username = account['username']
        print('Loading recent tweets in %s\'s timeline...' % (username,))
        tweets = twitter.get_home_timeline(account)
        for tweet in tweets:
            print('%s:\n\n%s' % (tweet['user']['screen_name'], tweet['text']))
            print('-' * 40)
    
    if __name__ == '__main__':
        main()
    

    posted in Pythonista read more
  • Drizzel

    If the code in tweet.py is exactly the same as what you showed us, you’re missing a # before the coding: utf-8. Corrected, you would have to change your first line to

    #coding: utf-8
    

    The # is commonly used for commenting your code in normal language, as it tells the python interpreter that the following line is no actual python code and can therefore be ignored. The interpreter makes your code understandable for machines and therefore executable also.

    If you want to know more or this is not the correct answer, just ask again and again and again 😋

    posted in Pythonista read more
  • Drizzel

    @mikael messages, as it doesn’t actually take too long and I don’t have to manage many small bits of data, making it easier for me (with limited python knowledge) to transfer multiple files.

    posted in Pythonista read more
  • Drizzel

    @cvp @JonB @mikael I did forget to decode the data after receiving it, my bad. It works flawlessly now, thanks a lot!

    posted in Pythonista read more
  • Drizzel

    @mikael
    I just gave it a first try, it didn’t completely work, but it was a promising start. The length of the data before sending and receiving is the same, so I’m assuming the data itself is fine. If I then write it to a file though, it’s only 719 bytes, not 4 mb as it should be. For now, I have no clue why, but as a I said it’s promising.

    posted in Pythonista read more
  • Drizzel

    @mikael I had an old version installed, so I just updated. I will definitely look into it now. It’s interesting that it apparently doesn’t require strings, which might fix the errors I’m currently fighting with :)

    @cvp I tried out your suggestion, and I now can transfer the data without getting errors! The issue I now have, is that the final file is about 2.5 times as large as the original, and it therefore won’t play. Reading in the file, converting it to a string and then writing it to a new file showed that the conversion to a string is where the data gets altered heavily, and obviously I have no idea what to do about it😂

    Any ideas?

    posted in Pythonista read more
  • Drizzel

    @cvp I tried it out, I got a different error now. It's "Object of type 'bytes' is not JSON serializable". Any idea why?

    posted in Pythonista read more
  • Drizzel

    Hi,
    I’ve made a multiplayer game some time ago using multipeer. Anyone who is interested can find some more information here.
    Now I wondered if I could transfer files (preferably .m4a) over it. I modified the module to store the received data in the variable “received”, so that I could access it comfortably with “multipeer.received”.

    I have tried reading files like this

    with open(“file.m4a”) as f: 
        data = f.read()
    

    but I always get an error that says cannot read byte at location...

    I wanted to then transfer the string with multipeer to my iPad.
    Is there any way to fix this, or could I send files from one device to another any other way?

    posted in Pythonista read more
  • Drizzel

    Impressive, thanks a lot👍

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!