← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 1872: Fix reading parameters from table (thanks Anton for patience)

 

I have a problem with this line in utils.py:
540       o.tags['line']='l!'



  File
"/home/gladk/dem/yade/currentMono/build/lib/yade-currentMono/py/yade/utils.py",
line 540, in readParamsFromTable
    o.tags['line']='l!'
NameError: name 'o' is not defined



What is it for?
______________________________


Anton Gladkyy


2009/12/8 <noreply@xxxxxxxxxxxxx>

> ------------------------------------------------------------
> revno: 1872
> committer: Václav Šmilauer <eudoxos@xxxxxxxx>
> branch nick: trunk
> timestamp: Tue 2009-12-08 14:45:43 +0100
> message:
>  Fix reading parameters from table (thanks Anton for patience)
> modified:
>  py/utils.py
>  scripts/test/batch/params.table
>  scripts/test/batch/sim.py
>
>
> --
> lp:yade
> https://code.launchpad.net/~yade-dev/yade/trunk<https://code.launchpad.net/%7Eyade-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<https://code.launchpad.net/%7Eyade-dev/yade/trunk/+edit-subscription>
> .
>
> === modified file 'py/utils.py'
> --- py/utils.py 2009-12-08 12:08:48 +0000
> +++ py/utils.py 2009-12-08 13:45:43 +0000
> @@ -551,12 +551,10 @@
>                # !something cols are skipped, those are env vars we don't
> treat at all (they are contained in description, though)
>                for col in vv.keys():
>                        if col=='description' or col[0]=='!': continue
> -                       if col not in kw.keys():
> -                               if (not unknownOk) and col[0]!='!': raise
> NameError("Parameter `%s' has no default value assigned"%names[i])
> -                       else:
> -                               continue # skipping unknown var
> +                       if col not in kw.keys() and (not unknownOk): raise
> NameError("Parameter `%s' has no default value assigned"%names[i])
>                        if vv[col]=='*': vv[col]=kw[col] # use default value
> for * in the table
> -                       else: kw.pop(col) # remove the var from kw, so that
> it contains only those that were default at the end of this loop
> +                       elif col in kw.keys(): kw.pop(col) # remove the var
> from kw, so that it contains only those that were default at the end of this
> loop
> +                       print 'ASSIGN',col,vv[col]
>                        exec('%s=%s'%(col,vv[col])) in __builtins__;
> tagsParams+=['%s=%s'%(col,vv[col])]; dictParams[col]=vv[col]
>        # assign remaining (default) keys to python vars
>        defaults=[]
>
> === modified file 'scripts/test/batch/params.table'
> --- scripts/test/batch/params.table     2009-12-08 12:08:48 +0000
> +++ scripts/test/batch/params.table     2009-12-08 13:45:43 +0000
> @@ -1,9 +1,9 @@
> -!OMP_NUM_THREADS important! unimportant this!
> +!OMP_NUM_THREADS important! unimportant this! more
>  # comment
>        # comment and empty line
>
> -3 51 'hummm' 3.1415
> -3 51 'paaah' =
> -= 52 = *
> -= =  'not' =
> -= 52 'yes' 2.71828
> +3 51 'hummm' 3.1415  'a'
> +3 51 'paaah' = 'b'
> += 52 = *  'c'
> += =  'not' = 'd'
> += 52 'yes' 2.71828 'e'
>
> === modified file 'scripts/test/batch/sim.py'
> --- scripts/test/batch/sim.py   2009-12-08 12:08:48 +0000
> +++ scripts/test/batch/sim.py   2009-12-08 13:45:43 +0000
> @@ -7,10 +7,12 @@
>        notInTable='notInTable'
>  )
>  print O.tags['description']
> +print 'important',important
> +print 'unimportant',unimportant
>  #print O.tags['params']
>  #print O.tags['defaultParams']
>  import time
> -time.sleep(5)
> +#time.sleep(5)
>  print 'finished'
>  import sys
>  sys.stdout.flush()
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References