POST
|
That worked! Perfect, thank you. I still have some finagling but this is definitely one step closer. If you don't mind, one more question. It uploaded the file but then I got an error about my closing of the file. I tried closing filepath, file_object, and filename and all got the error saying it received a string. # Choosing file to send filename = 'TEST12142020.pdf' filepath = r'C:\temp\{}'.format(filename) file_object = open(filepath, 'rb') print ('Opened file') # Sending the file print('Sending file') session.storbinary('STOR ' + filename, file_object) print('Sent file') # Closing file and ftp file.close(filepath) print('Closing file') session.quit() ERROR: Logging in Opened file Sending file Sent file Traceback (most recent call last): File "C:\temp\UploadtoFTPTest.py", line 19, in <module> file.close(filepath) TypeError: descriptor 'close' requires a 'file' object but received a 'str'
... View more
yesterday
|
0
|
2
|
49
|
POST
|
CODE: # Choosing file to send filepath = r'C:\temp\TEST12142020.pdf' file_object = open(filepath, 'rb') print ('Opened file') # Sending the file print('Sending file') session.storbinary('STOR ' + filepath, file_object) print('Sent file') ERROR: Logging in Opened file Sending file Traceback (most recent call last): File "C:\temp\UploadtoFTPTest.py", line 14, in <module> session.storbinary('STOR ' + filepath, file_object) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 471, in storbinary conn = self.transfercmd(cmd, rest) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 376, in transfercmd return self.ntransfercmd(cmd, rest)[0] File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 339, in ntransfercmd resp = self.sendcmd(cmd) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 249, in sendcmd return self.getresp() File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 224, in getresp raise error_perm, resp ftplib.error_perm: 553 Prohibited file name: C:\temp\TEST12142020.pdf
... View more
yesterday
|
0
|
5
|
57
|
POST
|
Hmmm, looks like the same error. Maybe I need to run it some way different than Python 27? Or my Python version is getting mixed up because I have both ArcMap and ArcPro installed on my computer? CODE: # Choosing file to send filepath = r'G:\GIS\filepath\TEST12142020.pdf' file_object = open(filepath, 'rb') print ('Opened file') # Sending the file print('Sending file') session.storbinary('STOR ' + filepath, file_object) print('Sent file') ERROR: Logging in Opened file Sending file Traceback (most recent call last): File "G:\GIS\Departments\ItmdGis\Users\hbubac\Data and Scripts\Crime Maps\new scripts\UploadtoFTPTest.py", line 14, in <module> session.storbinary('STOR ' + filepath, file_object) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 471, in storbinary conn = self.transfercmd(cmd, rest) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 376, in transfercmd return self.ntransfercmd(cmd, rest)[0] File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 339, in ntransfercmd resp = self.sendcmd(cmd) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 249, in sendcmd return self.getresp() File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 224, in getresp raise error_perm, resp ftplib.error_perm: 553 Prohibited file name: G:\GIS\Departments\ItmdGis\Users\hbubac\Data and Scripts\Crime Maps\new scripts\TEST12142020.pdf
... View more
yesterday
|
0
|
7
|
74
|
POST
|
Ah, my bad. You are right. I changed it to this: filepath = r'G:\GIS\Departments\ItmdGis\Users\hbubac\Data and Scripts\Crime Maps\new scripts' file_object = open(r'G:\GIS\Departments\ItmdGis\Users\hbubac\Data and Scripts\Crime Maps\new scripts\TEST12142020.pdf', 'rb') print ('Opened file') # Sending the file print('Sending file') session.storbinary('STOR ' + filepath, file_object) print('Sent file') And still got this for an error: Logging in Opened file Sending file Traceback (most recent call last): File "G:\GIS\Departments\ItmdGis\Users\hbubac\Data and Scripts\Crime Maps\new scripts\UploadtoFTPTest.py", line 14, in <module> session.storbinary('STOR ' + filepath, file_object) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 471, in storbinary conn = self.transfercmd(cmd, rest) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 376, in transfercmd return self.ntransfercmd(cmd, rest)[0] File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 339, in ntransfercmd resp = self.sendcmd(cmd) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 249, in sendcmd return self.getresp() File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 224, in getresp raise error_perm, resp ftplib.error_perm: 553 Prohibited file name: G:\GIS\Departments\ItmdGis\Users\hbubac\Data and Scripts\Crime Maps\new scripts
... View more
yesterday
|
0
|
9
|
78
|
POST
|
Ah, I didn't realize that filepath and file_object were actualy variable names that it would recognize, not just what I chose to call it. I am running the code through Notepad++ with Run on Python27 and got these errors: Logging in Opened file Sending file Traceback (most recent call last): File "G:\GIS\Departments\ItmdGis\Users\hbubac\Data and Scripts\Crime Maps\new scripts\UploadtoFTPTest.py", line 14, in <module> session.storbinary('STOR ' + filepath, file_object) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 471, in storbinary conn = self.transfercmd(cmd, rest) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 376, in transfercmd return self.ntransfercmd(cmd, rest)[0] File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 339, in ntransfercmd resp = self.sendcmd(cmd) File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 249, in sendcmd return self.getresp() File "C:\Python27\ArcGIS10.5\lib\ftplib.py", line 224, in getresp raise error_perm, resp ftplib.error_perm: 553 Prohibited file name: G:\\GIS\\Departments\\ItmdGis\\Users\\hbubac\\Data and Scripts\\Crime Maps\\new scripts
... View more
yesterday
|
0
|
11
|
80
|
POST
|
I also get the same error doing this: # Choosing file to send filename = open(r'G:\\GIS\\filepath\\TEST12142020.pdf', 'rb') print ('Opened file') # Sending the file print('Sending file') session.storbinary('STOR ' + filename) print('Sent file')
... View more
yesterday
|
0
|
0
|
129
|
POST
|
Hey Dan, so like this? I get the same error. filepath = r'G:\\GIS\\filepath' file_object = open(r'G:\\GIS\\filepath\\TEST12142020.pdf', 'rb') print ('Opened file') # Sending the file print('Sending file') session.storbinary('STOR ' + file_object, filepath) print('Sent file')
... View more
yesterday
|
0
|
14
|
129
|
POST
|
Hello, I am trying to upload a PDF using Python to an outside FTP server. However, I keep getting the error about concatenating string and and file objects. CODE: import ftplib # Logging into ftp site with login information session = ftplib.FTP("host","username","password") print('Logging in') # Choosing file to send filename = "TEST12142020.pdf" filepath = open(r'G:\\GIS\\filepath\\TEST12142020.pdf', 'rb') print ('Opened file') # Sending the file print('Sending file') session.storbinary('STOR ' + filepath, filename) print('Sent file') # Closing file and ftp file.close() print('Closing file') session.quit() ERROR: Logging in Opened file Sending file Traceback (most recent call last): File "G:\pathname\UploadtoFTPTest.py", line 14, in <module> session.storbinary('STOR ' + filepath, filename) TypeError: cannot concatenate 'str' and 'file' objects
... View more
yesterday
|
0
|
16
|
197
|
POST
|
One of the planners with the city that I am in would like to incorporate a 3D view of our downtown. She mostly uses GIS for PDF maps that are overlaid with our zoning data. We are aware of 3D scenes but have not worked with them extensively. Our Esri reps have mentioned Urban to use and are willing to do a demo but we do not want to buy the product just for this project. Has anyone else done a smaller scale 3D scene or map without needed the Urban license?
... View more
Wednesday
|
0
|
2
|
47
|
Online Status |
Offline
|
Date Last Visited |
yesterday
|