Why does this not run into an infinite loop?

Why does this not run into an infinite loop?

Content Index :

Why does this not run into an infinite loop?
Tag : python , By : Malikul
Date : January 11 2021, 05:14 PM

Hope this helps It does not "run foo3 again", it runs the foo3.py script again. The first time foo3.py was running was to produce the module __main__, the second time to produce the module foo3.py.
The behaviour is in fact (almost) as if you had a file named __main__.py and another named foo3.py both with these exact same content and you then run python __main__.py. This is what is happening.
import sys

def functionA():

    if 'foo3' in sys.modules:
        del sys.modules['foo3']

    from foo3 import functionB

def functionB():

  File ".../foo3.py", line 7, in functionA
    from foo3 import functionB
  File ".../foo3.py", line 17, in <module>
  File ".../foo3.py", line 7, in functionA
    from foo3 import functionB
RuntimeError: maximum recursion depth exceeded while calling a Python object

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Infinite Loop : Determining and breaking out of Infinite loop

Tag : algorithm , By : Ed.
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further There is no general case algorithm that can determine if a program is in an infinite loop or not for every turing complete language, this is basically the Halting Problem.
The idea of proving it is simple:

How to create infinite loop, call method in it on if(condition=true), and continue infinite loop after execution of meth

Tag : java , By : Willem van Schevikho
Date : March 29 2020, 07:55 AM
like below fixes the issue The code will keep running indefinitely due to your while(true) clause, regardless of what value x has (since x only dictates when RunFrame() gets called).
The only issue I see is that RunFrame throws some sort of exception or aborts the program. You can try it like below:
       catch(Exception e)

Executing two infinite loops together. 1 while loop for multithreaded server and other infinite loop for GUI

Tag : python , By : CHeMoTaCTiC
Date : March 29 2020, 07:55 AM
it should still fix some issue You need to start another thread for the main loop of the socket server. That will allow the main thread to run the UI.
Just replace the loop with this code:
def server_thread(s):
   while True:
      conn, addr = s.accept()


Difference between 'busy-wait' infinite loop and condition validation infinite loop

Tag : c , By : user187383
Date : March 29 2020, 07:55 AM
it helps some times Because waiting on a condition variable is a non-busy wait. The CPU isn't actually doing any work. Instead, the thread is idle, waiting on a signal. The thread is not given any CPU resources until the condition is signaled.
When the condition is signaled, the thread becomes eligible again, and the scheduler can once again allocate CPU resources to it.

The proper Python exception to break out of an infinite loop (that shouldnt be infinite)

Tag : python , By : PepeM
Date : March 29 2020, 07:55 AM
it should still fix some issue The only way this wouldn't occur is if do_stuff never returns false.
If that is the case create a custom exception. I usually create a MiscException (along with more specific exceptions)
Related Posts Related QUESTIONS :
  • How to split a string by a specific pattern in number of characters?
  • Python 3: how to scrape research results from a website using CSFR?
  • Setting the scoring parameter of RandomizedSeachCV to r2
  • How to send alert or message from view.py to template?
  • How to add qml ScatterSeries to existing qml defined ChartView?
  • Django + tox: Apps aren't loaded yet
  • My css and images arent showing in django
  • Probability mass function sum 2 dice roll?
  • Cannot call ubuntu 'ulimit' from python subprocess without using shell option
  • Dataframe Timestamp Filter for new/repeating value
  • Problem with clicking select2 dropdownlist in selenium
  • pandas dataframe masks to write values into new column
  • How to click on item in navigation bar on top of page using selenium python?
  • Add multiple EntityRuler with spaCy (ValueError: 'entity_ruler' already exists in pipeline)
  • error when replacing missing ')' using negative look ahead regex in python
  • Is there a way to remove specific strings from indexes using a for loop?
  • select multiple tags by position in beautifulSoup
  • pytest: getting AttributeError: 'CaptureFixture' object has no attribute 'readouterror' capturing stdout
  • Shipping PyGObject/GTK+ app on Windows with MingW
  • Python script to deduplicate lines in multiple files
  • How to prevent window and widgets in a pyqt5 application from changing size when the visibility of one widget is altered
  • How to draw stacked bar plot from df.groupby('feature')['label'].value_counts()
  • Python subprocess doesn't work without sleep
  • How can I adjust 'the time' in python with module Re
  • Join original np array with resulting np array in a form of dictionary? multidimensional array? etc?
  • Forcing labels on histograms in each individual graph in a figure
  • For an infinite dataset, is the data used in each epoch the same?
  • Is there a more efficent way to extend a string?
  • How to calculate each single element of a numpy array based on conditions
  • How do I change the width of Jupyter notebook's cell's left part?
  • Measure distance between lat/lon coordinates and utm coordinates
  • Installing megam for NLTK on Windows
  • filter dataframe on each value of a samn column have a specific value of another column in Panda\Python
  • Threading with pubsub throwing AssertionError: 'callableObj is not callable' in wxPython
  • Get grouped data from 2 dataframes with condition
  • How can I import all of sklearns regressors
  • How to take all elements except the first k
  • Whats wrong with my iteration list of lists from csv
  • Tensorflow Estimator API save image summary in eval mode
  • How to Pack with PyQt - how to make QFrame/Layout adapt to content
  • How do I get certain Time Range in Python
  • python doubly linked list - insertAfter node
  • Open .h5 file in Python
  • Joining a directory name with a binary file name
  • python, sort list with two arguments in compare function
  • Is it possible to print from Python using non-ANSI colors?
  • Pandas concat historical data using date minus some number of days
  • CV2: Import Error in Python OpenCV
  • Is it possible to do this loop in a one-liner?
  • invalid literal for int() with base 10: - django
  • Why does my code print a value that I have not assigned as yet?
  • the collatz func in automate boring stuff with python
  • How to find all possible combinations of parameters and funtions
  • about backpropagation deep neural network in tensorflow
  • Sort strings in pandas
  • How do access my flask app hosted in docker?
  • Replace the sentence include some text with Python regex
  • Counting the most common element in a 2D List in Python
  • logout a user from the system using a function in python
  • mp4 metadata not found but exists
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com