Legacy Oil and Gas and the Alberta Energy Regulator say falling river levels allowed crews to shut off a wellhead valve that was allowing a small amount of the deadly gas to escape.
The leaking section of pipe had been submerged by the flooding Sheep River.
It was originally damaged by debris in the rushing floodwaters.
Alberta officials say there was no threat to human health from the small leak of gas containing hydrogen sulphide.
Some parts of Turner Valley, which is southwest of Calgary, remain under an evacuation order, but that's because river levels remain high in the community.