He got his doctorate in 1897 and began to work as a school teacher in Vienna , and later in Hranice , Moravia . He received his doctorate in 1897 and began to work as a gymnasium professor , first in Vienna , and later in Hranice ( Moravia ) .