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

Problem with run_ray_tracing #159

Open
zhangyujun08 opened this issue Oct 17, 2023 · 24 comments
Open

Problem with run_ray_tracing #159

zhangyujun08 opened this issue Oct 17, 2023 · 24 comments

Comments

@zhangyujun08
Copy link

I am a beginner of xrt. I try to run an example script but encountered a problem. It occurs during calling the xrt.runner.run_ray_tracing function. In the line
runfile = mod.file
, it reports AttributeError: 'NoneType' object has no attribute 'file'
Could anybody help about this issue? Thanks a lot!

@zhangyujun08
Copy link
Author

There are two underscores before and after "file"

@kklmn
Copy link
Owner

kklmn commented Oct 17, 2023

What is printed by python --version?

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 18, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 18, 2023

According to the documentation, a list of FrameInfo is returned starting from version 3.5.

Don't know what is the problem here but I'll put an extra check there. Please try (the two middle lines are inserted):

    mod = inspect.getmodule(frm[0])
    if mod is None:
        mod = inspect.getmodule(frm)
    runfile = mod.__file__

Thank you for reporting it!

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 18, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 18, 2023

When in Spyder, try to run it in external system terminal.

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 18, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 18, 2023

What happens if you unzip the GitHub xrt package to any user location and run xrtQookStart.pyw from there?

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 18, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 18, 2023

I suspect you have several versions of xrt. Start python from your working directory and type

>>> import xrt
>>> xrt.__file__

Is the library location where you expect it to be? If not, delete it from there and try again.

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 18, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 18, 2023

Do you get a single iteration ready? (when you see values for N_all, N_good and Flux)
Try processes=1 in xrtr.run_ray_tracing(plots, repeats=24, ...)

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 18, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 18, 2023

Do you see an increased load in a system monitor?

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 19, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 19, 2023

I think that the problem with inspect is indicative of a corrupt python installation. The easiest solution is to install the latest WinPython and forget all the troubles.

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 19, 2023 via email

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 25, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 25, 2023

I think the problem is not with python version but rather with proper package management. With WinPython you get a portable system that doesn't need system paths, you can move it to any location, just run its command line shell and you have all the definitions inside. If you want to go a hard way of fixing broken paths and dependences inside your python installation, nobody can help you.

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 26, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 26, 2023

Make sure you start the WinPython's Spyder, not your previous Spyder version. Spyder's IPython console is not compatible with multiprocessing. So if you want multiprocessing, select the run option "Execute in an external system terminal".

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 26, 2023 via email

@kklmn
Copy link
Owner

kklmn commented Oct 26, 2023

How about running the script in an external system terminal (but still from Spyder)?
Alternatively, set processes=1.

@zhangyujun08
Copy link
Author

zhangyujun08 commented Oct 27, 2023 via email

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

2 participants