I want to read lines from a text document. But I can't seem to get the FTP connection working..
from ftplib import FTP
ftp=FTP('ftp.mydomain.com')
ftp.login('username','password')
ftp.retrlines('LIST')
I know this will list the directories.
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.
I want to read lines from a text document. But I can't seem to get the FTP connection working..
from ftplib import FTP
ftp=FTP('ftp.mydomain.com')
ftp.login('username','password')
ftp.retrlines('LIST')
I know this will list the directories.
Am I using anything wrong? I pretty much copied the example program..
EDIT: Trying it again I get "error_perm: 500 AUTH not understood"
EDIT: Sorry for the edits! It seems to be working now..? I switched to just FTP. Is it possible to read/write to a specific file via FTP?
I do not get any error messages.. just appears to by idle. Doesnt move on through the program. Sorry for short responses, as I am on my phone.
@dvader9: I have those in my program. was a typo when I wrote this post.
def changeBackground(sender):
z=sender.superview
x=1
while x<=10:
button='button'+str(x)
z[button].background_color=(0,0,0)
x+=1
time.sleep(1)
In my mind, this code (assuming that this gets called by pressing a button) should change the background color of 'button1', 'button2', and so on in order. Changing one every second.
However, if this code was ran the program would wait for 10 seconds and then update all of the buttons' background colors at once. How can I get it to update the UI at the time when that line of code is ran? I have tried z[button].set_needs_display()
to no avail.
Thanks!
I seem to have run into a problem..
I write
import os
import os.path
with open('save.txt','w') as f:
f.write('hello')
with open('save.txt','r') as f:
f.read()
Nothing happens. I don't get any errors, but the console output window doesn't even open.
I just want to save a single integer along with the date/time. I feel pretty stupid. I have no idea how this works as I have never done anything with reading/writing files before. How do I create a file to be written to?
Thank you all for the help! I once thought I was fairly fluent in Python, however I now realize how little I know.
EDIT: Another quick thing. Let's say I make a game on Pythonista, is it possible to make some sort of "savegame" file? That way You could save leaderboards and/or progress?