Python sleeps before keystroke

I am running a long python script on a Windows command line with several fingerprints in my code to track progress.

Before certain fingerprints, python code stops working, and CPU usage just drops to zero. I can "wake up" in python by pressing random keys on the keyboard with the command line window as the active window.

Using the task manager, I see that the CPU usage jumps, the print line processes ("The process took 219 seconds"), and then the script returns again.

Why do I need a child to control this file, and how can I make my code so that it does not?

-CC

start = time.time() monthsOfInterestSorted = sorted(monthsOfInterest) if debug: print "calculateTradingActivity:\n\tcalculating" tradingActivityComplete = (tsc.calculateTradingActivity(daily_volume, daily_shares, daily_dates, monthsOfInterestSorted)) if debug: print "\tlisting" tradingActivityList = [] ## this matrix should have unique sedol rows and date columns (date x sedol) for sedol, date in zip(monthly_sedol_list, monthly_dates_list): try: tradingActivityList.append(tradingActivityComplete[daily_sedol.index(sedol)][monthsOfInterestSorted.index(date)]) except ValueError: print "\t\tMissing trading activity data for:", sedol, date tradingActivityList.append('NA') print '\tProcess took %d seconds' % (time.time()-start) 
+1
source share

Source: https://habr.com/ru/post/1014596/


All Articles