Questions tagged [stopiteration]

The Python `StopIteration` exception.

72 questions
0
votes
0 answers

StopIteration error while using next() for Monocular depth estimation code

I am referencing https://keras.io/examples/vision/depth_estimation/#visualizing-samples code for one of my project however, I am getting error related to StopIteration. Could someone please suggest how this can be rectified? def…
be_real
  • 180
  • 1
  • 1
  • 12
0
votes
1 answer

Containerized python script fails with StopIteration

I am trying to write a python script which loads series of sql files in sequential manner. It works without an issue on my local machine, but as soon as it's executed from within a container it fails. Affected code iterator =…
Alekc
  • 4,682
  • 6
  • 32
  • 35
0
votes
1 answer

StopIteration Error when using next in Python 3 using nltk

I want to run a code in Python 3. It works in Python 2.7 and the input is not empty. Some parts of the code are as follows: parser = nltk.ChartParser(zinc_grammar.GCFG) parse_trees = [next(parser.parse(t)) for t in tokens] But it shows the…
Narcis
  • 441
  • 1
  • 3
  • 12
0
votes
3 answers

How to obtain rows and columns of a csv file imported in python?

I have multiple csv files for my application. I am trying to obtain number of rows and columns by reading the csv file. I have two csv files which I send through the argument file_path. First file has 5 rows and 3 columns and Second file has 5 rows…
Magneto
  • 17
  • 5
0
votes
2 answers

StopIteration error while trying to build data input for a model

from __future__ import print_function import tensorflow as tf import os #Dataset Parameters - CHANGE HERE MODE = 'folder' # or 'file', if you choose a plain text file (see above). DATASET_PATH = "D:\\Downloads\\Work\\" # the dataset file or root…
0
votes
1 answer

Is there a built-in `take(iterable, n)` function in Python3?

I just got bit by abusing StopIteration within some nested generators (using CPython 3.6.9), hadn't enabled PEP 479 (from __future__ import generator_stop), and had some bad hacky code that used next(iter(iterable)) that prematurely signaled a…
Eric Cousineau
  • 1,944
  • 14
  • 23
0
votes
1 answer

StopIteration issue in pandas dataframe with dictionary python

I have 3 column (DM1_ID, DM2_ID, pairs) pandas dataframe with 1 million records.Also, I have a dictionary containing key and multiple values. The function check the dictionary values and get the key and put that key in new_ID field. Function…
rra
  • 809
  • 1
  • 8
  • 20
0
votes
0 answers

model.fit StopIteration:

When training a neural network a Stop Iteration error occurs... That's the code to fit the model: model.fit( train_generator, steps_per_epoch = num_train_samples // batch_size, epochs = 10, validation_data = validation_generator, …
Tobitor
  • 1,388
  • 1
  • 23
  • 58
0
votes
1 answer

Iterator class failing to raise StopIteration on HDF5 data opened with h5py

I'm trying to implement an iterable class for the h5 dataset. class Argh(): def __init__(self, data): self.data = data self.c_idx = 0 def __getitem__(self, idx): return self.data[idx] def __len__(self): …
Sinbud
  • 40
  • 5
0
votes
1 answer

os.walk error , can't fill list with file names

I'm learning "Google colab" and got some problem with data reading. I've written a python script for filling folders names into arrays, but it doesn't fill at even one. TEST_PATH = "/content/gdrive/'My Drive'/test/" test_ids= [] try: test_ids =…
0
votes
1 answer

StopIteration Error During Entering Text to Text Box

I am trying to input a long string (around 4000 characters) into a text box using Python and Selenium. Once the full string is entered, the whole thing in the text box disappears and below error appears: Internal StopIteration:…
Echo Tang
  • 3
  • 2
0
votes
0 answers

Django StopIteration issue

I would like to get your help according to my issue : StopIteration. Principe: I have a function which get as arguments a list of ids and a specific id. This list of ids corresponds to an array with pagination. This function is called when I create…
Essex
  • 6,042
  • 11
  • 67
  • 139
0
votes
1 answer

Python - Scrubadub.clean not working - Cannot properly scrub text PII + HTTP Error 503

I'm sorry and this is probably a basic question but as I am learning scrubadub and trying to get it work myself on Jupyter notebook. It kept showing - HTTP Error 503: Service Unavailable This is what I input, which is exactly the same as the…
0
votes
1 answer

Python: Coroutines - StopIteration exception

I am trying to feed a dictionary by using .send(). And my code snippet is below def coroutine(func): def start(*args, **kwargs): cr = func(*args, **kwargs) next(cr) return cr return start @coroutine def putd(di): …
Raja G
  • 5,973
  • 14
  • 49
  • 82
0
votes
1 answer

What is iteration error in Wolframalpha api and how can I fix it?

So I'm working on making a simple research bot but I've run into a problem. I was following a guide on using wolfram alpha in python and when I test it I sometimes get the error Traceback (most recent call last): File "python", line 6, in…
Saradoc
  • 103
  • 1
  • 10