Batch rendering in Maya with Python - python

I am trying to render hundreds of images from maya using redshift but it's not working, I tried everything I could find online.
for i in range(10):
do_something()
prep_render_settings()
cmds.render()
this works fine but it only renders out images with Maya's internal engine, and I've tried changing the settings to redshift manually + with code but it always ends up rendering with maya software.
for i in range(10):
do_something()
prep_render_settings()
cmds.renderWindowEditor(editor,e=True, writeImage="...")
or
for i in range(10):
do_something()
prep_render_settings()
mel.eval("BatchRender;")
both successfully switch to Redshift, but the catch is that the script doesn't wait for the rendering to finish before moving on to the next round of the loop, so I end up with only 1 image render (the last one, bu named as the first one).
I'm trying to find a way to either:
1-make cmds.render() use redshift
2-call a function that will return whether or not the rendering is in progress, and only move on with the script if it's finished -in c4d there's a function called c4d.CheckIsRunning() that does exactly that-
Any help will be super appreciated, I've been stuck on this for days.
Thank you!

Related

Amazon Sagemaker Runs doesn't show any run with the new update

So I think the Sagemaker UI was updated very recently this week, and now I can't find any of my previous "runs" / "trials" / "jobs"...
When I go to home - Experiments, I can see the names of two experiments I have done in the past, but when I click on it, it just says "No runs / You don't have any runs". Not only did I have a bunch of runs / jobs (not sure if the term changed), but when I try to launch another one with my previously working script, it runs well (and saves itself well on S3) but doesn't show.
Anyone has the same problem ? Where should I turn to help ?
As part of those changes, automatically generated runs (previously called "trial components") are hidden by default.
On the "Runs" table for your experiment, click the cog icon in the upper right and enable "Show jobs". This will display any automatically generated runs in the table.

reset_Timer does not recognize by the while loop

I am a beginner in python. Here I have some face recognition projects from my school. In order to run my code, I use flask_ask. My code is supposed to stop after 8 minutes if the face recognition doesn't see my face. In order to do that I put a countdown function.
The problem is every time I run this known_Greeting(), it keeps saying NameError: name 'reset_Timer' is not defined. Indeed, I defined it inside the known_Greeting(). The face recognition is working, but the countdown is not working. If I replace reset_Timer=8 outside known_Greeting(), the countdown is work but it did nothing when the countdown reaches zero.
Without using the known_Greeting(), the code runs perfectly. I've been working on this code for 3 days already, and still couldn't figure it out. Below is my code. It is a bit long, so I will put the git link.
https://github.com/UMD-ENEE408I/ENEE408I_Spring_2021_Team_5/blob/main/python/face11.py
Below is the flask-ask that I am running this code.
https://github.com/UMD-ENEE408I/ENEE408I_Spring_2021_Team_5/blob/main/python/alexa4.py
This error suggests that reset_timer is not defined. As you are creating a new context with threading. Using global resources might create some issues.
Possible solution:
Try passing the reset_timer value in the parameter of the target file. Here I am trying to put the snippet for your code. Please update it on https://github.com/UMD-ENEE408I/ENEE408I_Spring_2021_Team_5/blob/main/python/face11.py#L44.
def countdown(reset_Timer):
while reset_Timer > 0:
print('T-minus', reset_Timer)
time.sleep(1)
reset_Timer -= 1
count = threading.Thread(target=countdown, args=(reset_Timer,))

Scripts overlapping while running in Pycharm

screenshot of my pycharm interface
Hey everyone. When I run this simple code (the tab 'youtubeyf.py
is to print 'hello world'), it produces the intended result but also another script (with the tab name "yfinance.py") result as well. In fact, the "yfinance.py" script doesn't need to be open in order for that result to appear too. It is almost as if it runs in the background, parallel without being open.
Goal: I want to run "print 'hello world'" without the dataframe from the other script appearing.
Problem: the dataframe is appearing without actually running or being open.
Troubleshoot attempts so far: I have "Alphabetted" and searched on StackOverflow, JetBrains on topics regarding reconfiguring the "run configurations", "parallels", and nothing yet.
Thank you for your time.
Edit 1: this does not solve my problem. for one, my issue isn't importing. in fact, everything is "running" smoothly, but that the results are two in one. It is analogous to two chefs preparing one meal each, say shrimp lo main and pizza, and then placing both meals onto one plate. I don't want that; I want to have shrimp lo main on Tuesday night, and then pizza Wednesday.
When importing yfinance, it could be possible that in that module, your code is structured such that when you import the module it runs a function or other code. In yfinance, you should delete any extraneous function that doesnt need to be run everytime you import yfinance somewhere else.
Edit: what you can do, if you dont want to change much of the structure yfinance.py, is wrap all the code that runs in that python file inside a main function and add the following:
if __name__=="__main__":
main()
This makes it so that python only runs main if you're actually running yfinance.py , and doesnt run main when you're importing it.

How to put Bokeh interactive maps on a Website?

How to do upload my interactive bokeh maps I created on a website? I read the documentation and used the file_html function to create the html code, but all the functionality does not work like the select drop down, and sliders. What is the best way to share it on a website?
This is the warning I received.
This is the Warning I received. WARNING:bokeh.embed.util: You are generating
standalone HTML/JS output, but trying to use real Python callbacks (i.e.
with on_change or on_event). This combination cannot work. Only JavaScript
callbacks may be used with standalone output. For more information on
JavaScript callbacks with Bokeh , see:
http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html
I tried to make that error message as self-contained as possible. I am not sure what else can be added to it, but suggestions are welcome. There are two scenarios:
Standalone output
This is purely HTML and JS content, that has no connection with any running python process. It is most often generated with output_file and show (or save), but it's also what you get if you use the lower level file_html function. Since there is no Python process anywhere after the output is created, there is no possible way for "real" Python callbacks to function, at all. In this case, the only possible callbacks that can work are JavaScript ones, e.g. CustomJS added with js_on_change or js_on_event. That's because the browser viewing the (purely HTML and JS) content does not know anything about Python, it only knows about JavaScript.
Bokeh Server Applications
This is a continuously running Bokeh server that serves Bokeh content, and,
most crucially: maintains an active connection to that content. That means that when some event happens, e.g. a slider changes, the Bokeh server can run real Python callback code in response. That is, in fact, the primary reason the Bokeh server exists: to be the thing that runs real Python code for an on_change or on_event callbacks. If you want to run real Python code (e.g. Numpy or Pandas or whatever) in response to events, you must run a Bokeh server.
Right click on the generated site in a web browser and select "Inspect". Then open the "console" tab and you list of errors will be detailed there. My guess is that you are not referencing a javascript file correctly.

Using Python, how to stop the screen from updating its content?

I searched the web and SO but did not find an aswer.
Using Python, I would like to know how (if possible) can I stop the screen from updating its changes to the user.
In other words, I would like to buid a function in Python that, when called, would freeze the whole screen, preventing the user from viewing its changes. And, when called again, would set back the screen to normal. Something like the Application.ScreenUpdating Property of Excel VBA, but applied directly to the whole screen.
Something like:
FreezeScreen(On)
FreenScreen(Off)
Is it possible?
Thanks for the help!!
If by "the screen" you're talking about the terminal then I highly recommend checking out the curses library. It comes with the standard version of Python. It gives control of many different aspects of the terminal window including the functionality you described.

Categories