matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
775 stars 392 forks source link

Basemap Can't work well in pywin32 #425

Closed Athenaplot closed 5 years ago

Athenaplot commented 5 years ago

I writed a window Service using pywin32, In the Service , I use Basemap to draw a map of B,but it can't work.

1537883575 1

the code is like above. the code in red block can work,but when it comes to the green block, the code can't go on , in other word , the code doesn't post a error message , so the procedure isn't killed. just like freeze.

1537885195 1

the window Service written by Python is just like above. but ,when i put the code as a Python Script,just like below:

1537884933 1

it can work well. I want my code for the window Service work well . is there anyone can help me out?

WeatherGod commented 5 years ago

I don't know much about windows services, but I will point out an observation. The call to map_B.readshapefile(...) in your service code will implicitly trigger a window creation via matplotlib. Depending on how your install is done and other things, this means a GUI framework is triggered. I don't know if that is allowed within a service. Perhaps if you added something along the lines of:

import matplotlib
matplotlib.use('agg')

at the top of the script to force a non-interactive backend, maybe the hang will go away?

On Tue, Sep 25, 2018 at 10:18 AM Athenaplot notifications@github.com wrote:

I wirted a window Service using pywin32, In the Service , I use Basemap to draw a map of beijing ,but it can't work.

[image: 1537883575 1] https://user-images.githubusercontent.com/31769682/46018883-78c96400-c10d-11e8-98b5-dbe56640b150.png

the code is like above. the code in red block can work,but when it comes to the green block, the code can't go on , in other word , the code doesn't post a error message , so the procedure isn't killed. just like freeze. [image: 1537884328 1] https://user-images.githubusercontent.com/31769682/46019691-43257a80-c10f-11e8-8e7c-35d4689f9c5f.png

the window Service written by Python is just like above. but ,when i put the code as a Python Script,just like below: [image: 1537884933 1] https://user-images.githubusercontent.com/31769682/46020297-9ea43800-c110-11e8-89c1-1af2c0becb3b.png

it can work well. is there anyone can help me out?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matplotlib/basemap/issues/425, or mute the thread https://github.com/notifications/unsubscribe-auth/AARy-F9R4jS12Q5QRBDhgxPBXVf8W436ks5uejsigaJpZM4W4u7A .

Athenaplot commented 5 years ago

I appreciate it so much,it works. @WeatherGod Thank you ,buddy!!!