[SPARK-12268][PYSPARK] Make pyspark shell pythonstartup work under python3
[SPARK-12268][PYSPARK] Make pyspark shell pythonstartup work under python3

This replaces the `execfile` used for running custom python shell scripts
with explicit open, compile and exec (as recommended by 2to3). The reason
for this change is to make the pythonstartup option compatible with python3.

Author: Erik Selin <erik.selin@gmail.com>

Closes #10255 from tyro89/pythonstartup-python3.

maropu/spark,guoxiaolongzte/spark,dhruve/spark,ibm-research-ireland/sparkoscope,apache-spark-on-k8s/spark,hvanhovell/spark,byakuinss/spark,akopich/spark,facaiy/spark,ueshin/apache-spark,cin/spark,MLnick/spark,SHASHANKB/spark,michalsenkyr/spark,sureshthalamati/spark,sachintyagi22/spark,big-pegasus/spark,zuotingbing/spark,metamx/spark,wangyum/spark,apache/spark,vinodkc/spark,apache/spark,rikima/spark,akopich/spark,SHASHANKB/spark,gengliangwang/spark,adrian-ionescu/apache-spark,LantaoJin/spark,ahnqirage/spark,nchammas/spark,debugger87/spark,aosagie/spark,chuckchen/spark,HyukjinKwon/spark,actuaryzhang/spark,poffuomo/spark,witgo/spark,kevinyu98/spark,chuckchen/spark,nilsgrabbert/spark,big-pegasus/spark,dongjoon-hyun/spark,patrick-nicholson/spark,brad-kaiser/spark,metamx/spark,rekhajoshm/spark,huang1900/spark,apache/spark,bdrillard/spark,wzhfy/spark,zhouyejoe/spark,apache-spark-on-k8s/spark,shubhamchopra/spark,rednaxelafx/apache-spark,alunarbeach/spark,kevinyu98/spark,joseph-torres/spark,ajaysaini725/spark,xuanyuanking/spark,ueshin/apache-spark,xuanyuanking/spark,dhruve/spark,zzcclp/spark,mdespriee/spark,joseph-torres/spark,mdespriee/spark,zhouyejoe/spark,shaneknapp/spark,ddna1021/spark,rikima/spark,loneknightpy/spark,alunarbeach/spark,ahnqirage/spark,WeichenXu123/spark,UndeadBaneGitHub/spark,mzl9039/spark,Panos-Bletsos/spark-cost-model-optimizer,liutang123/spark,dbtsai/spark,saltstar/spark,saltstar/spark,Panos-Bletsos/spark-cost-model-optimizer,xuanyuanking/spark,saturday-shi/spark,JoshRosen/spark,szhem/spark,ueshin/apache-spark,WeichenXu123/spark,WindCanDie/spark,andrewor14/spark,ron8hu/spark,xflin/spark,highfei2011/spark,holdenk/spark,goldmedal/spark,someorz/spark,witgo/spark,huang1900/spark,andrewor14/spark,JerryLead/spark,pgandhi999/spark,apache/spark,janewangfb/spark,kissmetrics/spark,nchammas/spark,janewangfb/spark,holdenk/spark,saltstar/spark,darionyaphet/spark,zero323/spark,spark-test/spark,big-pegasus/spark,rednaxelafx/apache-spark,cin/spark,aokolnychyi/spark,witgo/spark,LantaoJin/spark,bOOm-X/spark,big-pegasus/spark,someorz/spark,saltstar/spark,hhbyyh/spark,jianran/spark,adrian-ionescu/apache-spark,sachintyagi22/spark,shubhamchopra/spark,shaneknapp/spark,byakuinss/spark,Aegeaner/spark,bOOm-X/spark,kiszk/spark,bOOm-X/spark,sureshthalamati/spark,panfengfeng/spark,jlopezmalla/spark,lxsmnv/spark,metamx/spark,rednaxelafx/apache-spark,hhbyyh/spark,milliman/spark,alunarbeach/spark,panfengfeng/spark,setjet/spark,cin/spark,mike0sv/spark,ioana-delaney/spark,cin/spark,debugger87/spark,ericvandenbergfb/spark,saturday-shi/spark,publicRoman/spark,joseph-torres/spark,loneknightpy/spark,JoshRosen/spark,esi-mineset/spark,jlopezmalla/spark,alunarbeach/spark,metamx/spark,patrick-nicholson/spark,sahilTakiar/spark,milliman/spark,liyichao/spark,mike0sv/spark,MLnick/spark,eyalfa/spark,BryanCutler/spark,dongjoon-hyun/spark,icexelloss/spark,JoshRosen/spark,icexelloss/spark,ron8hu/spark,zhouyejoe/spark,goldmedal/spark,nilsgrabbert/spark,mahak/spark,rednaxelafx/apache-spark,pgandhi999/spark,chuckchen/spark,icexelloss/spark,techaddict/spark,holdenk/spark,kissmetrics/spark,andrewor14/spark,tengpeng/spark,xuanyuanking/spark,tejasapatil/spark,Aegeaner/spark,xflin/spark,mahak/spark,WindCanDie/spark,jrshust/spark,jkbradley/spark,wangmiao1981/spark,JerryLead/spark,actuaryzhang/spark,nchammas/spark,jianran/spark,panfengfeng/spark,panfengfeng/spark,pgandhi999/spark,facaiy/spark,aray/spark,narahari92/spark,aokolnychyi/spark,sahilTakiar/spark,aray/spark,markhamstra/spark,highfei2011/spark,SnappyDataInc/spark,JerryLead/spark,dhruve/spark,cloud-fan/spark,cloud-fan/spark,liutang123/spark,markhamstra/spark,highfei2011/spark,holdenk/spark,ibm-research-ireland/sparkoscope,jrshust/spark,panfengfeng/spark,markhamstra/spark,ron8hu/spark,saltstar/spark,markhamstra/spark,akopich/spark,huang1900/spark,sureshthalamati/spark,debugger87/spark,jrshust/spark,sachintyagi22/spark,rekhajoshm/spark,setjet/spark,ConeyLiu/spark,ptkool/spark,metamx/spark,eyalfa/spark,MLnick/spark,dbtsai/spark,Aegeaner/spark,nlalevee/spark,Panos-Bletsos/spark-cost-model-optimizer,yanboliang/spark,kimoonkim/spark,darionyaphet/spark,skonto/spark,caneGuy/spark,akopich/spark,lxsmnv/spark,1haodian/spark,mzl9039/spark,HyukjinKwon/spark,BryanCutler/spark,ueshin/apache-spark,gengliangwang/spark,facaiy/spark,ioana-delaney/spark,loneknightpy/spark,akopich/spark,icexelloss/spark,minixalpha/spark,tejasapatil/spark,caneGuy/spark,patrick-nicholson/spark,dbtsai/spark,tengpeng/spark,nchammas/spark,lvdongr/spark,zhouyejoe/spark,nchammas/spark,jrshust/spark,actuaryzhang/spark,joseph-torres/spark,aokolnychyi/spark,kevinyu98/spark,shuangshuangwang/spark,srowen/spark,ptkool/spark,BryanCutler/spark,liyichao/spark,esi-mineset/spark,bdrillard/spark,jiangxb1987/spark,minixalpha/spark,WindCanDie/spark,ahnqirage/spark,Aegeaner/spark,yanboliang/spark,actuaryzhang/spark,jlopezmalla/spark,UndeadBaneGitHub/spark,gioenn/xSpark,HyukjinKwon/spark,dhruve/spark,szhem/spark,wangyum/spark,bdrillard/spark,Aegeaner/spark,dhruve/spark,xflin/spark,hvanhovell/spark,huang1900/spark,srowen/spark,jiangxb1987/spark,ibm-research-ireland/sparkoscope,saturday-shi/spark,SnappyDataInc/spark,pgandhi999/spark,spark-test/spark,poffuomo/spark,apache-spark-on-k8s/spark,vinodkc/spark,darionyaphet/spark,SHASHANKB/spark,taroplus/spark,esi-mineset/spark,minixalpha/spark,caneGuy/spark,saturday-shi/spark,rekhajoshm/spark,apache-spark-on-k8s/spark,dbtsai/spark,brad-kaiser/spark,kissmetrics/spark,ptkool/spark,liyichao/spark,aray/spark,ibm-research-ireland/sparkoscope,ibm-research-ireland/sparkoscope,nilsgrabbert/spark,publicRoman/spark,rekhajoshm/spark,kimoonkim/spark,wzhfy/spark,markhamstra/spark,szhem/spark,srowen/spark,jkbradley/spark,bdrillard/spark,holdenk/spark,ahnqirage/spark,hvanhovell/spark,wangmiao1981/spark,aokolnychyi/spark,WindCanDie/spark,witgo/spark,skonto/spark,xflin/spark,someorz/spark,mdespriee/spark,setjet/spark,kiszk/spark,xuanyuanking/spark,shaneknapp/spark,SHASHANKB/spark,brad-kaiser/spark,rekhajoshm/spark,zuotingbing/spark,ddna1021/spark,UndeadBaneGitHub/spark,xflin/spark,jiangxb1987/spark,gengliangwang/spark,mzl9039/spark,wangyum/spark,zzcclp/spark,ajaysaini725/spark,minixalpha/spark,ptkool/spark,milliman/spark,gengliangwang/spark,esi-mineset/spark,sureshthalamati/spark,dongjoon-hyun/spark,ptkool/spark,ron8hu/spark,ioana-delaney/spark,adrian-ionescu/apache-spark,someorz/spark,sahilTakiar/spark,rikima/spark,SHASHANKB/spark,zuotingbing/spark,maropu/spark,zzcclp/spark,mahak/spark,michalsenkyr/spark,dbtsai/spark,bOOm-X/spark,dbtsai/spark,JerryLead/spark,sureshthalamati/spark,andrewor14/spark,setjet/spark,tengpeng/spark,metamx/spark,map222/spark,big-pegasus/spark,xflin/spark,ibm-research-ireland/sparkoscope,guoxiaolongzte/spark,LantaoJin/spark,WeichenXu123/spark,cin/spark,michalsenkyr/spark,kissmetrics/spark,setjet/spark,loneknightpy/spark,liutang123/spark,actuaryzhang/spark,jkbradley/spark,shubhamchopra/spark,loneknightpy/spark,rikima/spark,spark-test/spark,techaddict/spark,apache/spark,spark-test/spark,tejasapatil/spark,liyichao/spark,zero323/spark,mahak/spark,jiangxb1987/spark,aosagie/spark,cloud-fan/spark,JoshRosen/spark,sachintyagi22/spark,stanzhai/spark,milliman/spark,caneGuy/spark,cloud-fan/spark,mike0sv/spark,jkbradley/spark,poffuomo/spark,lvdongr/spark,rikima/spark,HyukjinKwon/spark,jlopezmalla/spark,icexelloss/spark,nlalevee/spark,kiszk/spark,WeichenXu123/spark,wzhfy/spark,apache/spark,janewangfb/spark,publicRoman/spark,lvdongr/spark,skonto/spark,liutang123/spark,jlopezmalla/spark,ahnqirage/spark,shubhamchopra/spark,kiszk/spark,nlalevee/spark,adrian-ionescu/apache-spark,skonto/spark,map222/spark,lxsmnv/spark,gengliangwang/spark,joseph-torres/spark,wangmiao1981/spark,WindCanDie/spark,mahak/spark,patrick-nicholson/spark,WindCanDie/spark,yanboliang/spark,Panos-Bletsos/spark-cost-model-optimizer,maropu/spark,wzhfy/spark,witgo/spark,someorz/spark,publicRoman/spark,tejasapatil/spark,wzhfy/spark,ConeyLiu/spark,taroplus/spark,saturday-shi/spark,adrian-ionescu/apache-spark,gioenn/xSpark,caneGuy/spark,spark-test/spark,zero323/spark,zhouyejoe/spark,SnappyDataInc/spark,map222/spark,kissmetrics/spark,srowen/spark,rezasafi/spark,shuangshuangwang/spark,wangyum/spark,zzcclp/spark,WeichenXu123/spark,facaiy/spark,kimoonkim/spark,janewangfb/spark,cloud-fan/spark,UndeadBaneGitHub/spark,srowen/spark,loneknightpy/spark,HyukjinKwon/spark,BryanCutler/spark,holdenk/spark,guoxiaolongzte/spark,sahilTakiar/spark,zhouyejoe/spark,nlalevee/spark,metamx/spark,kimoonkim/spark,saturday-shi/spark,rezasafi/spark,shuangshuangwang/spark,loneknightpy/spark,map222/spark,hhbyyh/spark,lvdongr/spark,rezasafi/spark,MLnick/spark,cloud-fan/spark,darionyaphet/spark,taroplus/spark,ericvandenbergfb/spark,1haodian/spark,zuotingbing/spark,kevinyu98/spark,liutang123/spark,dongjoon-hyun/spark,lvdongr/spark,kiszk/spark,Panos-Bletsos/spark-cost-model-optimizer,zero323/spark,poffuomo/spark,patrick-nicholson/spark,WeichenXu123/spark,chuckchen/spark,pgandhi999/spark,spark-test/spark,darionyaphet/spark,jiangxb1987/spark,andrewor14/spark,guoxiaolongzte/spark,gioenn/xSpark,JoshRosen/spark,minixalpha/spark,holdenk/spark,sahilTakiar/spark,janewangfb/spark,joseph-torres/spark,yanboliang/spark,taroplus/spark,LantaoJin/spark,lvdongr/spark,JerryLead/spark,rednaxelafx/apache-spark,stanzhai/spark,maropu/spark,ConeyLiu/spark,jianran/spark,aokolnychyi/spark,ioana-delaney/spark,yanboliang/spark,ajaysaini725/spark,techaddict/spark,eyalfa/spark,andrewor14/spark,big-pegasus/spark,aray/spark,vinodkc/spark,bdrillard/spark,ueshin/apache-spark,Panos-Bletsos/spark-cost-model-optimizer,rikima/spark,dongjoon-hyun/spark,debugger87/spark,MLnick/spark,ahnqirage/spark,tengpeng/spark,liyichao/spark,nilsgrabbert/spark,bravo-zhang/spark,mzl9039/spark,stanzhai/spark,1haodian/spark,wzhfy/spark,sachintyagi22/spark,Aegeaner/spark,nlalevee/spark,guoxiaolongzte/spark,zuotingbing/spark,ericvandenbergfb/spark,WeichenXu123/spark,apache/spark,saturday-shi/spark,liutang123/spark,matthewfranglen/spark,tengpeng/spark,jrshust/spark,poffuomo/spark,lxsmnv/spark,kimoonkim/spark,actuaryzhang/spark,narahari92/spark,michalsenkyr/spark,JerryLead/spark,shaneknapp/spark,jiangxb1987/spark,map222/spark,ddna1021/spark,szhem/spark,jkbradley/spark,zzcclp/spark,ericvandenbergfb/spark,kiszk/spark,hhbyyh/spark,mzl9039/spark,eyalfa/spark,wangmiao1981/spark,actuaryzhang/spark,jianran/spark,aosagie/spark,ueshin/apache-spark,jianran/spark,narahari92/spark,bravo-zhang/spark,zero323/spark,huang1900/spark,alunarbeach/spark,milliman/spark,aokolnychyi/spark,nilsgrabbert/spark,kimoonkim/spark,big-pegasus/spark,shuangshuangwang/spark,Panos-Bletsos/spark-cost-model-optimizer,rekhajoshm/spark,mdespriee/spark,goldmedal/spark,esi-mineset/spark,patrick-nicholson/spark,gioenn/xSpark,wangyum/spark,highfei2011/spark,aosagie/spark,narahari92/spark,liutang123/spark,alunarbeach/spark,debugger87/spark,mdespriee/spark,sachintyagi22/spark,goldmedal/spark,byakuinss/spark,tejasapatil/spark,wangyum/spark,eyalfa/spark,rednaxelafx/apache-spark,aosagie/spark,cloud-fan/spark,ron8hu/spark,jiangxb1987/spark,bOOm-X/spark,zero323/spark,cin/spark,techaddict/spark,JoshRosen/spark,chuckchen/spark,UndeadBaneGitHub/spark,caneGuy/spark,zuotingbing/spark,milliman/spark,rezasafi/spark,LantaoJin/spark,chuckchen/spark,shubhamchopra/spark,rednaxelafx/apache-spark,yanboliang/spark,maropu/spark,highfei2011/spark,witgo/spark,skonto/spark,SnappyDataInc/spark,mike0sv/spark,wangmiao1981/spark,ron8hu/spark,eyalfa/spark,mike0sv/spark,zhouyejoe/spark,poffuomo/spark,byakuinss/spark,ajaysaini725/spark,rezasafi/spark,setjet/spark,vinodkc/spark,shaneknapp/spark,SnappyDataInc/spark,gioenn/xSpark,stanzhai/spark,wzhfy/spark,ericvandenbergfb/spark,MLnick/spark,WindCanDie/spark,gioenn/xSpark,gioenn/xSpark,goldmedal/spark,esi-mineset/spark,minixalpha/spark,hhbyyh/spark,saltstar/spark,BryanCutler/spark,taroplus/spark,ptkool/spark,skonto/spark,kimoonkim/spark,SnappyDataInc/spark,lvdongr/spark,guoxiaolongzte/spark,ConeyLiu/spark,narahari92/spark,LantaoJin/spark,eyalfa/spark,highfei2011/spark,hvanhovell/spark,poffuomo/spark,yanboliang/spark,shaneknapp/spark,tengpeng/spark,mzl9039/spark,nilsgrabbert/spark,1haodian/spark,JoshRosen/spark,shubhamchopra/spark,BryanCutler/spark,ddna1021/spark,ericvandenbergfb/spark,1haodian/spark,shuangshuangwang/spark,kevinyu98/spark,tejasapatil/spark,aray/spark,bravo-zhang/spark,mdespriee/spark,srowen/spark,ptkool/spark,BryanCutler/spark,kiszk/spark,kissmetrics/spark,dhruve/spark,aray/spark,ioana-delaney/spark,zuotingbing/spark,lxsmnv/spark,aokolnychyi/spark,xflin/spark,wangmiao1981/spark,UndeadBaneGitHub/spark,huang1900/spark,dhruve/spark,aosagie/spark,mike0sv/spark,debugger87/spark,facaiy/spark,spark-test/spark,akopich/spark,aosagie/spark,taroplus/spark,taroplus/spark,gengliangwang/spark,dbtsai/spark,mzl9039/spark,jrshust/spark,ajaysaini725/spark,pgandhi999/spark,goldmedal/spark,markhamstra/spark,nchammas/spark,shuangshuangwang/spark,maropu/spark,cin/spark,techaddict/spark,byakuinss/spark,minixalpha/spark,milliman/spark,jlopezmalla/spark,stanzhai/spark,esi-mineset/spark,ueshin/apache-spark,zzcclp/spark,rikima/spark,kevinyu98/spark,srowen/spark,sureshthalamati/spark,janewangfb/spark,HyukjinKwon/spark,dongjoon-hyun/spark,ajaysaini725/spark,liyichao/spark,shubhamchopra/spark,liyichao/spark,vinodkc/spark,bOOm-X/spark,SHASHANKB/spark,jianran/spark,chuckchen/spark,HyukjinKwon/spark,nilsgrabbert/spark,SnappyDataInc/spark,facaiy/spark,rezasafi/spark,andrewor14/spark,tejasapatil/spark,jkbradley/spark,bravo-zhang/spark,janewangfb/spark,shuangshuangwang/spark,Aegeaner/spark,panfengfeng/spark,jlopezmalla/spark,kevinyu98/spark,bravo-zhang/spark,narahari92/spark,hhbyyh/spark,mdespriee/spark,ddna1021/spark,xuanyuanking/spark,alunarbeach/spark,brad-kaiser/spark,brad-kaiser/spark,ConeyLiu/spark,wangyum/spark,panfengfeng/spark,JerryLead/spark,SHASHANKB/spark,1haodian/spark,mahak/spark,publicRoman/spark,goldmedal/spark,skonto/spark,facaiy/spark,xuanyuanking/spark,techaddict/spark,pgandhi999/spark,huang1900/spark,bdrillard/spark,byakuinss/spark,michalsenkyr/spark,adrian-ionescu/apache-spark,mahak/spark,setjet/spark,michalsenkyr/spark,hvanhovell/spark,darionyaphet/spark,hhbyyh/spark,kissmetrics/spark,saltstar/spark,highfei2011/spark,bdrillard/spark,byakuinss/spark,bravo-zhang/spark,markhamstra/spark,szhem/spark,someorz/spark,sureshthalamati/spark,jkbradley/spark,zzcclp/spark,sahilTakiar/spark,publicRoman/spark,map222/spark,icexelloss/spark,debugger87/spark,shaneknapp/spark,ericvandenbergfb/spark,michalsenkyr/spark,szhem/spark,brad-kaiser/spark,ConeyLiu/spark,gengliangwang/spark,nchammas/spark,adrian-ionescu/apache-spark,techaddict/spark,publicRoman/spark,narahari92/spark,stanzhai/spark,ddna1021/spark,UndeadBaneGitHub/spark,akopich/spark,rekhajoshm/spark,map222/spark,wangmiao1981/spark,guoxiaolongzte/spark,vinodkc/spark,stanzhai/spark,patrick-nicholson/spark,hvanhovell/spark,mike0sv/spark,tengpeng/spark,icexelloss/spark,1haodian/spark,vinodkc/spark,ConeyLiu/spark,ibm-research-ireland/sparkoscope,LantaoJin/spark,darionyaphet/spark,caneGuy/spark,ioana-delaney/spark,bOOm-X/spark,apache-spark-on-k8s/spark,dongjoon-hyun/spark,ddna1021/spark,sachintyagi22/spark,hvanhovell/spark,nlalevee/spark,maropu/spark,apache-spark-on-k8s/spark,lxsmnv/spark,ioana-delaney/spark,someorz/spark,nlalevee/spark,sahilTakiar/spark,jianran/spark,ron8hu/spark,witgo/spark,aray/spark,apache-spark-on-k8s/spark,ahnqirage/spark,bravo-zhang/spark,zero323/spark,MLnick/spark,lxsmnv/spark,joseph-torres/spark,szhem/spark,ajaysaini725/spark,jrshust/spark,rezasafi/spark,brad-kaiser/spark