← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 3015: O and wrapper.Omega made part of __builtin__ (equivalent to global variables). Should solve probl...

 

------------------------------------------------------------
revno: 3015
committer: Jan Stransky <_honzik@xxxxxxxxxx>
branch nick: yade
timestamp: Thu 2012-02-02 12:07:09 +0100
message:
  O and wrapper.Omega made part of __builtin__ (equivalent to global variables). Should solve problem of question 182459
modified:
  core/main/main.py.in
  py/__init__.py.in


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'core/main/main.py.in'
--- core/main/main.py.in	2011-11-28 06:40:50 +0000
+++ core/main/main.py.in	2012-02-02 11:07:09 +0000
@@ -175,7 +175,6 @@
 		if sum(bool(arg0.endswith(ext)) for ext in ('.xml','.xml.bz2','.xml.gz','.yade','.yade.gz','.yade.bz2','.bin','.bin.gz','.bin.bz2'))>0:
 			if len(sys.argv)>1: raise RuntimeError('Extra arguments to saved simulation to run: '+' '.join(sys.argv[1:]))
 			sys.stderr.write("Running simulation "+arg0+'\n')
-			O=yade.wrapper.Omega(); O.load(arg0); O.run()
 		if arg0.endswith('.py'):
 			def runScript(script):
 				sys.stderr.write("Running script "+arg0+'\n')

=== modified file 'py/__init__.py.in'
--- py/__init__.py.in	2010-11-30 13:51:41 +0000
+++ py/__init__.py.in	2012-02-02 11:07:09 +0000
@@ -1,4 +1,3 @@
-# The purpose of this file is twofold: 
 # 1. it tells python that yade (this directory) is package of python modules
 #	see http://http://www.python.org/doc/2.1.3/tut/node8.html#SECTION008400000000000000000
 #
@@ -76,4 +75,8 @@
 # import a few "important" modules along with *
 import utils # some others?
 __all__+=['utils',]+dir(miniEigen)+dir(wrapper)
+# make O and wrapper.Omega part of __builtin__ (equvialent to global)
+import __builtin__
+__builtin__.__dict__['O'] = O
+__builtin__.__dict__['Omega'] = wrapper.Omega