Forums

run program in virtual environment using bash gives different result than when executed successfully in Tasks

I am using Mapbox in my virtual env with a python program using the Mapbox API. I am uploading new data every hour. It works. Using my bash console in the virtual environment, it picks up the my new geojson data file, and updates my mapbox map perfectly. When using the path below in the Tasks, it works, but I think it is stuck using the old geojson file rather than the new one I build every hour. The Mapbox python API communicates successfully In Tasks:

source virtualenvwrapper.sh && workon env_beach && python3.5 /home/kpilgrim1504/lake_model_2/mapbox/Uploads_Final.py

Im using OS path: filedir = os.path.dirname(file) filedir_mapbox_file = os.path.join(filedir, 'LakesGeoJSON4_end.geojson')

Is that my problem? Its strange because everything works, its just not picking up the newly generated file?

If you're running some sort of loop where you expect the file to change and you're only opening the file outside the loop, then you'll have the old contents for the entire run.

Or perhaps you're not reading the file you think you're reading. Have the task log the full path to the file it's reading and the contents so you can be sure that you're looking at the same file.

Another possibility is that you are uploading just after a run, and so you'd only see the changes the next hour.

Thanks for the response. It is possible that I was uploading too early as I made the change as you suggest and it appears to be working properly now. Thanks.