Created
April 22, 2015 16:12
-
-
Save larssono/d5212d555f3ea1d98ff0 to your computer and use it in GitHub Desktop.
This code in Synapse
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
def thisCodeInSynapse(parentId, file=None, description=''): | |
"""Determines the name of the file that the code is called from | |
and uploads that to Synapse returning the synapseId of created codeObject. | |
""" | |
#print inspect.getfile(inspect.currentframe()) | |
#print os.path.abspath(inspect.getfile(inspect.currentframe())) | |
file = inspect.getfile(sys._getframe(1)) if file==None else file | |
#Make sure unallowed characters are striped out for the name | |
code= synapseclient.File(file, name=os.path.split(file)[-1], parent=parentId, description=description) | |
codeEntity = syn.store(code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment