-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyNoddyBinderUtility.py
More file actions
41 lines (30 loc) · 1003 Bytes
/
PyNoddyBinderUtility.py
File metadata and controls
41 lines (30 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from shutil import copyfile
import os
def importModulesAndSetup():
import pynoddy
##############
# Some file fixes
##############
basepynoddyfile = pynoddy.__file__[:-11]+'experiment/__init__.py'
# Read in the file
with open(basepynoddyfile, 'r') as file :
filedata = file.read()
# Replace the target string
filedata = filedata.replace('from . import util.sampling as Sample', 'from .util import sampling as Sample')
# Write the file out again
with open(basepynoddyfile, 'w') as file:
file.write(filedata)
target = pynoddy.__file__[:-11]+'output.py'
source = 'output.py'
copyfile(source, target)
target = pynoddy.__file__[:-11]+'history.py'
source = 'history.py'
copyfile(source, target)
##############
# Changing exection permissions
##############
folder = os.getcwd()
noddyEXE = folder+'/noddy.exe'
strV = 'chmod 777 '+noddyEXE
os.system(strV)
import pynoddy.experiment