Created
September 21, 2010 04:52
-
-
Save larrycai/589219 to your computer and use it in GitHub Desktop.
cross platform execution in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# call markdown to convert markdown -> html in memory | |
def mkd2html(inFilename): | |
# | |
# and there are different ways to handle windows and unix | |
# also subprocess.check_output exist in python27 only. | |
# | |
cmd = [] | |
# mostly msysgit is used, cygwin, it is win32 platform | |
if sys.platform == "win32": | |
# i may need to check cygwin as well | |
mkdownrealpath = os.path.expanduser(cmdmarkdown) | |
cmd = ["c:\\python27\\python.exe",mkdownrealpath] | |
else: # unix | |
cmd = [cmdmarkdownSuSE] | |
cmd.append(inFilename) | |
output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] | |
html = output.splitlines() | |
return html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment