As part of my application, i want to enable a pretty straightforward scenario as follows:
- user uses fileloader (the upload widget in design mode) to choose/select a Microsoft Word document (.docx) file for uploading :
def file_loader_1_change(self, file, **event_args):
“”“This method is called when a new file is loaded into this FileLoader”""
file_to_analyze = file
- uploaded file is sent to server side code :
anvil.server.call(‘my_server_function’, file_to_analyze)
- on Anvil server side get the file and send the file via uplink to an external (external from Anvil that is) computer:
@anvil.server.callable
def my_server_function(file_to_analyze):
anvil.server.call(“my_remote_computer_uplinked_function”, file_to_analyze)
- open the Word file on remote computer, process it, save the results of processing, and return the processed file back to Anvil server app for further disposition
The problem is i get the following error when i try to open the file on the remote computer:
AttributeError: .Open
at C:/users/james/appdata/local/programs/python/python38/lib/site-packages/win32com/client/dynamic.py, line 554
called from C:/Users/James/AppData/Local/Temp/ipykernel_10368/3064749683.py, line 346
called from C:/Users/James/AppData/Local/Temp/ipykernel_10368/3064749683.py, line 2697
called from ServerModule1, line 18
called from Home, line 80
The application works fine on the non-Anvil remote computer when i load the Word docx into the remote application using a local Word file on disk.
But when i try to pass the Anvil uploaded file it does not recognize the file type when i try to open it.
I have been assuming that the actual Word docx file itself that was uploaded on the Anvil platform is what I am passing over via uplink to my application so I just cannot fathom why it is not working.
Any ideas on what to do??.