Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workspace object + exec() command #23

Closed
Travis-S opened this issue Apr 3, 2017 · 3 comments
Closed

workspace object + exec() command #23

Travis-S opened this issue Apr 3, 2017 · 3 comments
Labels
bug A bug or regression

Comments

@Travis-S
Copy link
Contributor

Travis-S commented Apr 3, 2017

On the feature-dashboards branch in Tutorial 20, running this code

from pygsti.report import workspace
w = workspace.Workspace()

Gave rise to this SyntaxError:

File "/Users/tlschol/Desktop/pyGSTi/packages/pygsti/report/workspace.py", line 158
    exec(factory_func_def, exec_globals) #Python 3
SyntaxError: function 'makefactory' uses import * and bare exec, which are illegal because it is a nested function

In pygsti/report/workspace.py, the relevant lines are

exec_globals = {'cls' : cls, 'self': self}
if _sys.version_info > (3, 0):
    exec(factory_func_def, exec_globals) #Python 3
else:
    exec("""exec factory_func_def in exec_globals""") #Python 2

A similar issue arises if you comment out the first part of the if/then, and have the interpreter check the other line:

File "/Users/tlschol/Desktop/pyGSTi/packages/pygsti/report/workspace.py", line 161
    exec("""exec factory_func_def in exec_globals""") #Python 2
SyntaxError: unqualified exec is not allowed in function 'makefactory' because it is a nested function

This syntax error prevents the creation of the workspace object, which in turn blocks the user from executing any of the remaining code in Tutorials 20, 21, or 22.

The system I am using has pygsti 0.9.3, and Python 2.7.12 :: Anaconda custom (x86_64).

@Travis-S Travis-S added the bug A bug or regression label Apr 3, 2017
@enielse
Copy link
Collaborator

enielse commented Apr 3, 2017

Thanks for noticing this Travis. I had only been testing with Python3. I think commit 1a98c84 to feature-dashboards fixes the issues with running the Tutorials. Please try again and let me know if you still encounter issues.

@Travis-S
Copy link
Contributor Author

Travis-S commented Apr 3, 2017

The workspace object is now operating! The tutorials run.

@Travis-S
Copy link
Contributor Author

Closing this issue.

enielse pushed a commit that referenced this issue May 17, 2017
The "data_comparator" class which was in reports/datasetcomparison.py
has been renamed to "DataComparator" and relocated to
objects/datacomparator.py for better organization & convention
conformance.  The matplotlib data-comparison plotting routines have
been removed from DataComparator and recreated (to the best of my
ability) using Plotly in a new DatasetComparisionPlot class and as
a new "dscmp" display option of ColorBoxPlot.

The demo notebook has been updated and renamed to Tutorial #23
since the dashboards merge added Tutorials 20-22.  Docstrings still
need to be added throughout datacomparator.py and for the new
DatasetComparisonPlot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug or regression
Projects
None yet
Development

No branches or pull requests

2 participants