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

Line 77, x is not defined error #9

Open
pdeitel opened this issue Dec 29, 2017 · 4 comments
Open

Line 77, x is not defined error #9

pdeitel opened this issue Dec 29, 2017 · 4 comments

Comments

@pdeitel
Copy link

pdeitel commented Dec 29, 2017

I downloaded the code and tried to run it. I am getting

Traceback (most recent call last):
File "code/cube_interactive.py", line 46, in
class Cube:
File "code/cube_interactive.py", line 77, in Cube
for theta in (np.pi / 2, -np.pi / 2)]
File "code/cube_interactive.py", line 77, in
for theta in (np.pi / 2, -np.pi / 2)]
NameError: name 'x' is not defined

Any idea why?

@cadrians
Copy link

Looks like you are trying to run the code in Python3.

You have to change the lines 77 and 79 to:

rots = [Quaternion.from_v_theta(np.eye(3)[0], theta)
for theta in (np.pi / 2, -np.pi / 2)]
rots += [Quaternion.from_v_theta(np.eye(3)[1], theta)
for theta in (np.pi / 2, -np.pi / 2, np.pi, 2 * np.pi)]

Furthermore in file projection.py you have to change line 160 to:

trans = list(range(1, dproj.ndim)) + [0]

After these two changes the code runs fine.

I will try to commit the changes to the repository.

@cadrians
Copy link

See the fork https://github.com/cadrians/MagicCube

It runs fine in Python3.

@pdeitel
Copy link
Author

pdeitel commented Jan 16, 2018 via email

stonebig added a commit to stonebig/MagicCube that referenced this issue Aug 16, 2018
stonebig added a commit to stonebig/MagicCube that referenced this issue Aug 16, 2018
@davidwhogg
Copy link
Owner

if it's fixed now, close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants