[Tutor] FTP file transfer stops, no error given

Craig Jackson craig.r.jackson at gmail.com
Thu May 19 14:01:00 EDT 2016


Adding the parentheses worked. So sorry for taking your time. I'm new
to Python and not at all a programmer. Thanks for your help.

On Thu, May 19, 2016 at 11:37 AM, Alan Gauld via Tutor <tutor at python.org> wrote:
> On 19/05/16 15:11, Craig Jackson wrote:
>
>> ftp. In a nutshell the problem is that if the two objectives are
>> combined into one Python script, ftp stops uploading in the middle of
>> the file, but if the same code is split into two files, web page
>> creation in one script and ftp in another, and they are run
>> separately, ftp uploads the entire file and it all works. Below are
>> the details.
>
> Unfortunately you seem to have sent the variation that works.
> We cannot really tell what is going on unless we can see the
> code that fails.
>
> There is one possibility based on the code below...
>
>> htmlpage.write('<!DOCTYPE html><html><head><meta
>> charset="UTF-8"><title>Peckerwood Garden Docent Notes</title>\n')
>> htmlpage.write('<meta name="robots" content="noindex">')
>> htmlpage.write('<META NAME="ROBOTS" CONTENT="NOARCHIVE">')
>> htmlpage.write('<link rel=Stylesheet href="css/stylesheet.css"></head>\n')
>> htmlpage.write('<body>\n')
>> htmlpage.write('<table>\n')
>> htmlpage.write('<tr>\n')
>> htmlpage.write('<th class="uid">Unique ID</th>\n')
>> htmlpage.write('<th class="loc">Location</th>\n')
>> htmlpage.write('<th class="nam">Name</th>\n')
>> htmlpage.write('<th class="fam">Family</th>\n')
>> htmlpage.write('<th class="com">Common Name</th>\n')
>> htmlpage.write('<th class="nat">Nativity</th>\n')
>> htmlpage.write('<th class="pho">Photographs</th>\n')
>> htmlpage.write('<th class="des">Description</th>\n')
>> htmlpage.write('</tr>\n')
>
> Consider using triple quoted strings to save yourself a lot of typing
> and to make the html easier to read.
>
>> ...
>>     htmlpage.write('</td>')
>>     htmlpage.write('<td class="des">' + description +'</td></tr>\n')
>> htmlpage.write('</table></body></html>')
>> htmlpage.close
>
> Note that there are no parens after close. So you do not execute the
> function and the file is not closed.
>
> If you then try to ftp the still open file that could explain the
> problems you are having. Whereas if you run this as a separate script
> the file will be auto-closed at the end of the script so running the
> ftp separately will work..
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list