Tagged Questions
0
votes
0answers
14 views
How to convert String to hexa byte [duplicate]
I want to convert an hexa string formated like "0xf7d64850" to little endian bytes. I want a string that gave the same result when printed as print("\x50\x48\xd6\xf7")
So, at the moment I'm able to ...
0
votes
1answer
53 views
Python Stack Overflow with tkinter and threading
I have a problem about python stack overflow. I am writing an application with python using Tkinter and 4 other threads. but the problem is that after an hour of working, i get the stack overflow ...
1
vote
1answer
30 views
My quicksort hangs for list of size 2^13
I've written a quicksort function in python as follows.
def quickSort1(A,p,q):
if p < q:
pivotIndex = partition(A,p,q)
quickSort1(A,p,pivotIndex-1)
quickSort1(A,...
0
votes
0answers
77 views
Diagnosing IronPython StackOverflowException
I have a program that essentially reads a temp sensor and writes the readings to a file in an infinite loop (i.e. keep running until I crash/exit the program). Worked great on first machine - Iron ...
5
votes
1answer
2k views
Fatal Python error: Cannot recover from stack overflow. During Flood Fill
I've come to a dead end, and after excessive (and unsuccessful) Googling, I need help.
I'm building a simple PyQt4 Widget where it lies out a grid of 60x80 squares, each initialized to None. If the ...
2
votes
0answers
75 views
Compare deeply nested lists safely?
The following simple comparison of pure lists explodes on me:
a, b = [], []
for _ in range(1000):
a, b = [a], [b]
a == b
Python 3.5.1:
Traceback (most recent call last):
File "<pyshell#17&...
5
votes
3answers
2k views
Why is my stack buffer overflow exploit not working?
So I have a really simple stackoverflow:
#include <stdio.h>
int main(int argc, char *argv[]) {
char buf[256];
memcpy(buf, argv[1],strlen(argv[1]));
printf(buf);
}
I'm trying to ...
-4
votes
1answer
113 views
How to save data in a for loop by Python
I am new in Python programming. I want to save the field output request
[mdb.models['Model-1'].fieldOutputRequests['F-Output-1'].setValues(variables=('S', 'U', 'SF'))]
as a text file for each loop ...
0
votes
1answer
65 views
Quicksort: Non-in-place implementation works. In-place implementation exceeds maximum recursion depth. Why?
def quicksort_stable(l):
if not l:
return l
else:
pivot = l[0]
return quicksort_stable([x for x in l if x < pivot]) \
+ [x for x in l if x == pivot] \...
1
vote
1answer
47 views
Scrapy stack overflow of Requests
I have the following while loop to scrap pages
def after_login(self, response):
i=100000
while (i<2000000):
yield scrapy.Request("https://www.example.com/foobar.php?nr="+str(i),...
3
votes
1answer
242 views
python pandas overflow error dataFrame
I am rather new to python and I am using the pandas library to work with data frames.
I created a function "elevate_power" that reads in a data frame with one column of floating point values (example ...
1
vote
0answers
93 views
A way to run an infinite loop without the stackoverflowexception on ironpython?
I'm having a little problem when trying to run an infinite loop in ironpython 2.7
Here is my script:
import urllib
import urllib2
import json
a=0
info = ''
def getInfo():
url = 'https://api....
4
votes
1answer
41 views
How to stop the stack from overflowing when generating permutations in python
I'm trying to generate permutations in python without using itertools. This is my code thus far:
def generatePermutations(minVal, maxVal, arrayLength, depth = -1, array = []):
if(depth == -1): # ...
7
votes
2answers
8k views
How could you increase the maximum recursion depth in Python? [duplicate]
Interesting topic of recursion and stack overflow in class today and I wondered if there is any way of increasing the maximum recursion depth in Python? Wrote a quick function for finding the ...
2
votes
1answer
58 views
Python NLTK: parse string using conjoint structure, getting into infinite recursion
I am new in python and nltk. I am asked to create two different parse tree for the following sentence:
Adam slept while Josh ate and the dog barked.
Based on these two constructions:
S-> S ...
0
votes
1answer
150 views
Stack overflow on logging python module
I'm having a problem with python 3, I'm trying to log the stdout and the stderr to a log file. I was able to figure it out using http://www.electricmonk.nl/log/2011/08/14/redirect-stdout-and-stderr-to-...
0
votes
1answer
22 views
Save unsent message in Django
When I am about to write a question on Stackoverflow and suddently closes the window it wont delete my message. When I return to the question form it has saved what I wrote last time.
Is it just a ...
0
votes
1answer
2k views
Trying to create a pause function using tkinter in python , but code crashing when restarting
This is my code. It's part of bigger code for creating a data subscription app. I am trying to add a pause and restart function to it. The pause function is working perfectly but whenever I am trying ...
-2
votes
1answer
393 views
recursive stack overflow in fibonacci function
I'm triying to understand the stack overflow mecanism of a recursive function.
So i used this fibonacci function :
def fib(n):
if n==1 or n==2:
return 1
return fib(n-1)+fib(n-2)
print (fib(555))...
0
votes
0answers
174 views
s_push: parser stack overflow solution
I am having a problem with Spyder Python, trying to send data to a method.
The only thing that Spyder is returning is a short message:
s_push: parser stack overflow
Which does not help too much...
...
1
vote
1answer
486 views
Python, Numpy Stack overflow
I'm trying to do some image manipulation in python but I was having some trouble with the stack overflowing. After reading a little, I edited the np.array to take an extra parameter dtype='int64'. (It ...
1
vote
0answers
208 views
pydoc modules causing stack smashing
In order to see if a python module is installed, I ran the following on a terminal:
match=$(pydoc modules | grep $aModule)
Something went wrong, and now it always outputs this:
$ pydoc modules
...
0
votes
1answer
886 views
Restricting floating point values to avoid overflow in python
I'm writing a program that utilizes Euler's Method to calculate whether or not an asteroid's orbit will result in a collision with Earth. At the end of each iteration of the main loop, there is an if ...
2
votes
1answer
513 views
Stack Overflow when Pyparsing Ada 2005 Scoped Identifiers using Reference Manual Grammar
I'm currently implementing an Ada 2005 parser using Pyparsing and the reference manual grammar rules. We need this in order to analyze and transform parts of our aging Ada-codebase to C/C++.
Most ...
-1
votes
1answer
1k views
Ways to avoid Stack Overflow error in threads in Python
As a native Java developer, I think I have reached a situation which is what I am used to.
I am developing a multi-threaded Python 2.7 application using PyDev and running from Eclipse on Windows 7 64 ...
125
votes
6answers
41k views
Does Python optimize tail recursion?
I have the following piece of code which fails with the following error:
RuntimeError: maximum recursion depth exceeded
I attempted to rewrite this to allow for tail recursion optimization (TCO). ...
2
votes
0answers
172 views
Eclipse + Python: Stack overflow during debug - not run
I have the following Python code in Eclipse which causes stack overflow when debugging:
v = ogr.Feature(layer.GetLayerDefn())
The method calls are part of the GDAL/OGR library and the Error message ...
3
votes
3answers
3k views
Python: nested lambdas — `s_push: parser stack overflow Memory Error`
I recently stumbled across this article which describes how to code FizzBuzz using only Procs in Ruby, and since I was bored, thought it would be neat to try and implement the same thing in Python ...
5
votes
2answers
2k views
How to cause stack overflow and heap overflow in python
I am trying to understand how python manages stack and heap. So I wanted to do some "bad" programming and cause a stack overflow and heap overflow. What I don't understand is why strings for example ...
-1
votes
1answer
558 views
How to optimize a generic flood fill algorithm to prevent stack overflow?
The generic implementation of flood-fill algorithm runs into stack overflow, is there any way to optimize this? I am using this algorithm to find distinct void zones within building models. I voxelize ...
1
vote
1answer
216 views
Why does Tkinter stack overflow on Windows?
This short Python script debugwin.py works great on my Linux machine:
>>> import debugwin
>>> l = []
>>> debuwin.watch(l)
0
>>> l.append(1)
However, people have ...
6
votes
2answers
295 views
Why does this Python script create an infinite loop? (recursion)
Why/how does this create a seemingly infinite loop? Incorrectly, I assumed this would cause some form of a stack overflow type error.
i = 0
def foo () :
global i
i += 1
try :
...
0
votes
1answer
1k views
“TypeError: 'NoneType' object is not callable” sometimes appears, sometimes - not
I have 2 functions for reading data from file and putting it to dictionary.
def read_input():
f = open(r"D:\data.txt","r")
g = {}
for ln in f.readlines():
...g = ...
f.close()
return g
...
7
votes
2answers
3k views
Python ValueError: not allowed to raise maximum limit
I'm using python 2.7.2 on mac os 10.7.3
I'm doing a recursive algorithm in python with more than 50 000 recursion levels.
I tried to increase the maximum recursion level to 1 000 000 but my python ...
0
votes
1answer
77 views
IndexError from calling an Integer
I'm working on an infix to prefix program utilizing a stack class. However, the push() method is raising an IndexError whenever I call an integer, even though I have an Exception Handler and I'm ...
3
votes
1answer
583 views
Reducing capabilities of markdown in python
I'm writing a comment system. It has to be have formatting system like stackoverflow's.
Users can use some inline markdown syntax like bold or italic. I thought that i can solve that need with using ...
1
vote
4answers
767 views
Handling memory usage for big calculation in python
I am trying to do some calculations with python, where I ran out of memory. Therefore, I want to read/write a file in order to free memory. I need a something like a very big list object, so I thought ...