Guest User

Untitled

a guest
Feb 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. @app.route('/pp.php', methods=['GET', 'POST'])
  2. def pp():
  3. pp = My1Form()
  4. target = os.path.join(APP_ROOT, 'images/')
  5. print(target)
  6. if pp.validate_on_submit():
  7. for fileBase in request.files.getlist("fileBase"):
  8. print(fileBase)
  9. filename = fileBase.filename
  10. destination = "/".join([target, filename])
  11. print(destination)
  12. fileBase.save(destination)
  13. for fileObsRover in request.files.getlist("fileObsRover"):
  14. print(fileObsRover)
  15. filename = fileObsRover.filename
  16. destination = "/".join([target, filename])
  17. print(destination)
  18. fileObsRover.save(destination)
  19. for fileNavRover in request.files.getlist("fileNavRover"):
  20. print(fileNavRover)
  21. filename = fileNavRover.filename
  22. destination = "/".join([target, filename])
  23. print(destination)
  24. fileNavRover.save(destination)
  25. a=fileObsRover.filename
  26. b=fileBase.filename
  27. c=fileNavRover.filename
  28. elevation=pp.ema.data
  29. Freq=pp.frq.data
  30. posMode=pp.pmode.data
  31.  
  32. command='rnx2rtkp -p '+posMode+' -f '+Freq+' -m '+elevation+' -n -o oout.pos '+a+' '+b+' '+c
  33. #command='rnx2rtkp -p 0 -m '+elevation+' -n -o out.pos '+a+' '+c
  34. os.system(command)
  35. email_user = ''
  36. email_password = ''
  37. email_send = pp.email.data
  38. subject = 'subject'
  39. msg = MIMEMultipart()
  40. msg['From'] = email_user
  41. msg['To'] = email_send
  42. msg['Subject'] = subject
  43. body = 'This is your Post-Processed position file'
  44. msg.attach(MIMEText(body,'plain'))
  45. filename='oout.pos'
  46. attachment =open(filename,'rb')
  47. part = MIMEBase('application','octet-stream')
  48. part.set_payload((attachment).read())
  49. encoders.encode_base64(part)
  50. part.add_header('Content-Disposition',"attachment; filename= "+filename)
  51. msg.attach(part)
  52. text = msg.as_string()
  53. server = smtplib.SMTP('smtp.gmail.com',587)
  54. server.starttls()
  55. server.login(email_user,email_password)
  56. server.sendmail(email_user,email_send,text)
  57. server.quit()
  58.  
  59. return render_template('results.html', email=email_send, Name=pp.Name.data, ema=elevation, frq=Freq, pmode=posMode)
  60. return render_template('pp.html', pp=pp)
Add Comment
Please, Sign In to add comment