NameError in IPython session

Asked by Jan Stránský

Hello,

consider a very simple script a.py:

a = 1

when I run
yade-trunk a.py
and then write
a
in IPython, its value is normally printed.

But if the script looks like this one:

import yade
from yade import *
a = 1

run by
yade-trunk a.py
then writing
a
in IPython results in

NameError: name 'a' is not defined

do you know why? how to make 'a' accessible in IPython session?

Thanks for suggestions
Jan

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Anton Gladky
Solved:
Last query:
Last reply:
Revision history for this message
tranviet (tranviet2302) said :
#1

Hello,

I have just tried it. It works fine for me. Which YADE version are you using?May be I am using an older YADE version

Viet

Revision history for this message
Jan Stránský (honzik) said :
#2

Hi,
sorry, I am using latest trunk version on Ubuntu 12.04
Jan

2012/9/10 tranviet <email address hidden>

> Question #208180 on Yade changed:
> https://answers.launchpad.net/yade/+question/208180
>
> Status: Open => Answered
>
> tranviet proposed the following answer:
> Hello,
>
> I have just tried it. It works fine for me. Which YADE version are you
> using?May be I am using an older YADE version
>
> Viet
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Best Anton Gladky (gladky-anton) said :
#3

Hi,

please, do not import yade directly, as it is done automatically by configrutaion scripts.
You get "cross-import" and some variables are lost.

Just remove first 2 lines of your script and everything should work.

Anton

Revision history for this message
Jan Stránský (honzik) said :
#4

Thanks Anton Gladky, that solved my question.

Revision history for this message
Jan Stránský (honzik) said :
#5

How simple :-)
thanks a lot
Jan

2012/9/10 Anton Gladky <email address hidden>

> Question #208180 on Yade changed:
> https://answers.launchpad.net/yade/+question/208180
>
> Status: Open => Answered
>
> Anton Gladky proposed the following answer:
> Hi,
>
> please, do not import yade directly, as it is done automatically by
> configrutaion scripts.
> You get "cross-import" and some variables are lost.
>
> Just remove first 2 lines of your script and everything should work.
>
> Anton
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>