0

I am trying to run a python script (the script resides on a directory in \wwwroot directory in my app file system) from my web app using java, the script uses a binary file (g.bin), the binary file size is huge (3.5+ GB), so I stored it in a storage account (file service), now I want to use the data found in the bin file, How can I open the file using my script? What is the path that the python script should use and how to open it?

1 Answer 1

1

You need to use azure-storage python SDK, and the module you need is azure.storage.file.fileservice

First initialize the FileService

f = FileService(account_name=None, account_
                key=None, sas_token=None,
                protocol=’https’, endpoint_
                suffix=’core.windows.net’,
                request_session=None, connection_
                string=None)

Then you need to download the file to a stream using fileservice.get_file_to_stream method.

f.get_file_to_stream(share_name, directory_name, file_name, stream, start_range=None, end_range=None, validate_content=False, progress_callback=None, max_connections=2, timeout=None, snapshot=None)

Give that a try. If you can't get it to work, update your question with what you tried, and I'll be happy to help.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I need to read the binary file using word2vec like that : model = KeyedVectors.load_word2vec_format('site/wwwroot/GoogleNews-vectors-negative300.bin', binary=True, limit = 100000) what is the url in this case? I got no such file or directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.