{"action":"created","issue":{"url":"https://api.github.com/repos/m-labs/artiq/issues/545","repository_url":"https://api.github.com/repos/m-labs/artiq","labels_url":"https://api.github.com/repos/m-labs/artiq/issues/545/labels{/name}","comments_url":"https://api.github.com/repos/m-labs/artiq/issues/545/comments","events_url":"https://api.github.com/repos/m-labs/artiq/issues/545/events","html_url":"https://github.com/m-labs/artiq/issues/545","id":174384293,"number":545,"title":"Can't call GUI arguments in build","user":{"login":"r-srinivas","id":11219276,"avatar_url":"https://avatars.githubusercontent.com/u/11219276?v=3","gravatar_id":"","url":"https://api.github.com/users/r-srinivas","html_url":"https://github.com/r-srinivas","followers_url":"https://api.github.com/users/r-srinivas/followers","following_url":"https://api.github.com/users/r-srinivas/following{/other_user}","gists_url":"https://api.github.com/users/r-srinivas/gists{/gist_id}","starred_url":"https://api.github.com/users/r-srinivas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r-srinivas/subscriptions","organizations_url":"https://api.github.com/users/r-srinivas/orgs","repos_url":"https://api.github.com/users/r-srinivas/repos","events_url":"https://api.github.com/users/r-srinivas/events{/privacy}","received_events_url":"https://api.github.com/users/r-srinivas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/m-labs/artiq/milestones/2","html_url":"https://github.com/m-labs/artiq/milestones/2.0","labels_url":"https://api.github.com/repos/m-labs/artiq/milestones/2/labels","id":1590370,"number":2,"title":"2.0","description":"","creator":{"login":"sbourdeauducq","id":720864,"avatar_url":"https://avatars.githubusercontent.com/u/720864?v=3","gravatar_id":"","url":"https://api.github.com/users/sbourdeauducq","html_url":"https://github.com/sbourdeauducq","followers_url":"https://api.github.com/users/sbourdeauducq/followers","following_url":"https://api.github.com/users/sbourdeauducq/following{/other_user}","gists_url":"https://api.github.com/users/sbourdeauducq/gists{/gist_id}","starred_url":"https://api.github.com/users/sbourdeauducq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbourdeauducq/subscriptions","organizations_url":"https://api.github.com/users/sbourdeauducq/orgs","repos_url":"https://api.github.com/users/sbourdeauducq/repos","events_url":"https://api.github.com/users/sbourdeauducq/events{/privacy}","received_events_url":"https://api.github.com/users/sbourdeauducq/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":49,"state":"open","created_at":"2016-02-18T10:17:53Z","updated_at":"2016-09-02T00:25:53Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2016-08-31T21:32:47Z","updated_at":"2016-09-02T02:08:05Z","closed_at":null,"body":"Using (2.0.dev+563.gc4559fc) on windows, the following code,\r\n\r\n```python\r\nfrom artiq.experiment import *\r\n\r\n\r\nclass GUI_Argument_Test(EnvExperiment):\r\n\r\n\r\n    def build(self):\r\n        self.setattr_argument('x', NumberValue(1))\r\n        self.setattr_argument('y', NumberValue(2))\r\n        self.z = self.x + self.y\r\n\r\n    def run(self):\r\n        print(self.z)\r\n```\r\n\r\nhas the error,\r\n\r\n```\r\nTypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'\r\nERROR:worker(examine,gui_argument_test.py):root:Terminating with exception (Type\r\nError: unsupported operand type(s) for +: 'NoneType' and 'NoneType')\r\nTraceback (most recent call last):\r\n  File \"C:\\Anaconda3\\envs\\artiq-2016-08-31\\lib\\site-packages\\artiq\\master\\worker\r\n_impl.py\", line 243, in main\r\n    examine(ExamineDeviceMgr, ParentDatasetDB, obj[\"file\"])\r\n  File \"C:\\Anaconda3\\envs\\artiq-2016-08-31\\lib\\site-packages\\artiq\\master\\worker\r\n_impl.py\", line 145, in examine\r\n    exp_class((device_mgr, dataset_mgr, argument_mgr))\r\n  File \"C:\\Anaconda3\\envs\\artiq-2016-08-31\\lib\\site-packages\\artiq\\language\\envi\r\nronment.py\", line 207, in __init__\r\n    self.build(*args, **kwargs)\r\n  File \"c:\\artiq-magtrap\\repository\\test\\gui_argument_test.py\", line 13, in buil\r\nd\r\n    self.z = self.x + self.y\r\nTypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'\r\n```\r\n\r\nThis was working before in 1.x. I can move any operations into prepare, and then it works,\r\n\r\n```python\r\nfrom artiq.experiment import *\r\n\r\n\r\nclass GUI_Argument_Test(EnvExperiment):\r\n\r\n\r\n    def build(self):\r\n        self.setattr_argument('x', NumberValue(1))\r\n        self.setattr_argument('y', NumberValue(2))\r\n\r\n    def prepare(self):\r\n        self.z = self.x + self.y\r\n\r\n    def run(self):\r\n        print(self.z)\r\n```\r\n\r\nBut it's useful I think to be able to manipulate gui arguments in the build section if you're constructing dependent gui variables. "},"comment":{"url":"https://api.github.com/repos/m-labs/artiq/issues/comments/244264965","html_url":"https://github.com/m-labs/artiq/issues/545#issuecomment-244264965","issue_url":"https://api.github.com/repos/m-labs/artiq/issues/545","id":244264965,"user":{"login":"r-srinivas","id":11219276,"avatar_url":"https://avatars.githubusercontent.com/u/11219276?v=3","gravatar_id":"","url":"https://api.github.com/users/r-srinivas","html_url":"https://github.com/r-srinivas","followers_url":"https://api.github.com/users/r-srinivas/followers","following_url":"https://api.github.com/users/r-srinivas/following{/other_user}","gists_url":"https://api.github.com/users/r-srinivas/gists{/gist_id}","starred_url":"https://api.github.com/users/r-srinivas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r-srinivas/subscriptions","organizations_url":"https://api.github.com/users/r-srinivas/orgs","repos_url":"https://api.github.com/users/r-srinivas/repos","events_url":"https://api.github.com/users/r-srinivas/events{/privacy}","received_events_url":"https://api.github.com/users/r-srinivas/received_events","type":"User","site_admin":false},"created_at":"2016-09-02T02:08:05Z","updated_at":"2016-09-02T02:08:05Z","body":"When would that computation be executed then?"}}
{"actor":{"display_login":"r-srinivas"}}