All elections of district attorneys shall be contested and decided in the same manner as is now provided by law for contesting the election of county officers; and if any vacancy shall occur, either by death, resignation, removal from office or from the county, or otherwise, the judges of the court of common pleas shall supply such vacancy, by the appointment of a competent person to fill the office until the next general election: Provided, Such vacancy happens thirty days before; if not, then until the next general election thereafter, and until a successor is duly elected and qualified.
16 P.S. § 7703