1

Hello I'm getting an error when uploading a new azure webjob. The error says it cant create the webjob.

I followed this tutorial which I found it in a question that was asked in here. Link

My script is the following:

import sys, os
sys.path.append(os.path.join(os.getcwd(), "site-packages"))
import requests as req

r = req.get('http://my_website.azurewebsites.net/user/cron')
# Development
# r = req.get('http://localhost:5000/user/cron')
print(r.status_code)

And the structure of my files is this one enter image description here

If anyone can point out where I made a mistake, I just searched for hours and many questions and tutorials point out this is the proper way to add a library in Azure.

2
  • Hi, would you please post the details about of the error you see.(e.g. a screenshot) Commented Feb 1, 2018 at 1:31
  • Hi, any updates? Does my answer helps you? Commented Feb 23, 2018 at 8:54

1 Answer 1

3

Please refer to the steps as below which I uploaded python script into Webjobs previously.

Step 1 : Use the virtualenv component to create an independent python runtime environment in your system.Please install it first with command pip install virtualenv if you don't have it.

If you installed it successfully ,you could see it in your python/Scripts file.

enter image description here

Step2 : Run the commad to create independent python runtime environment.

enter image description here

Step 3: Then go into the created directory's Scripts folder and activate it (this step is important , don't miss it)

enter image description here

Please don't close this command window and use pip install <your libraryname> to download external libraries in this command window.

enter image description here

Step 4:Keep the Sample.py uniformly compressed into a folder with the libs packages in the Libs/site-packages folder that you rely on.

enter image description here

Step 5: Create webjob in Web app service and upload the zip file,then you could execute your Web Job and check the log

enter image description here

You could also refer to the SO thread :Options for running Python scripts in Azure

Hope it helps you.

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

Comments

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.