Q:

how to price barrier option under local vol model using QuantLib

I use QuantLib in Python. Now I have implied volatility surface data. How can I get the local vol surface than using finite difference method to price a barrier option in QuantLib?

A:

From a cursory look, the FdBlackScholesBarrierEngine seems to do what you want; when the localVol parameter is set to true, it will use the local volatility contained in the passed process. I'd suggest you to check the code, though.
As a further note: the GeneralizedBlackScholesProcess class converts the Black volatility to the local one internally (see the code here) so you might not need to.

