Fix error when path contains periods

If `modulename` contains a "." symbol then `basemodulename` only gets the second part of it, so something like `/some/path/python2.7/site-packages` becomes `7/site-packages`. This patch fixes that by using `os.path.splitext` instead of `string.split`.