2,207,744 questions
9
votes
1
answer
24k
views
How to make a simple proxy in python?
I wanted to make a very simple proxy using python (mostly to understand how it works). I am talking about a generic TCP proxy, not only http.
I have built the following code, however, it seems to only ...
56
votes
6
answers
29k
views
Java abstract/interface design in Python
I have a number of classes which all share the same methods, only with different implementations. In Java, it would make sense to have each of these classes implement an interface or extend an ...
2
votes
3
answers
10k
views
How to enable cookie with Python requests?
I want to sign in Amazon.com with Python.
But I can't do it even if I use requests.Session() , because I can't "Enable Cookies".
Could you tell me how to fix the code? Why "dict(response.cookies)" ...
7
votes
3
answers
3k
views
Python unittest, running only the tests that failed
I have a large Python test file using unittest that I run from the command line. Some tests take a while to run. This is a mild pain point, because I'm often only concerned with the last test I added....
0
votes
1
answer
45
views
Can someone help me not make the code terminate whenever i input "right"
i understand this is seemingly simple im a beginner i apologize if ive wasted anyones time but im pretty lost rn heres my code
print ("you awaken in a dark room")
print ("you look to ...
2
votes
1
answer
1k
views
How to rerun a specific pytest test, based on the output error
Say if Appium throws a webdriver exception error, only then that specific test should rerun in pytest.
10
votes
3
answers
24k
views
Rerun failed test after all other tests using pytest
In my scenario, I have one test that writes a file, and one (but potentially many more) tests that would want to read that file.
I cannot simply extract writing that file to a function/fixture, ...
Best practices
2
votes
5
replies
66
views
Python script interface
I have a few python scripts that I want to run on a small raspberry pi project I've been working on and I want to use a launcher or something so I can launch them without a pc or anything does anyone ...
0
votes
3
answers
3k
views
How to export ppt slide as image using pptx python
I want to export a ppt slide as an png format image through pptx python.
I have gone through this solution using win32com but facing error as com_error: (-2147221005, 'Invalid class string', None, ...
10
votes
1
answer
10k
views
Usage of 'learning_phase' in keras for tensorflow backend?
I am trying to train a resnet network using keras backend in tensorflow. The feed dictionary for each batch update is written as:
feed_dict= {x:X_train[indices[start:end]], y:Y_train[indices[...
Advice
0
votes
3
replies
32
views
Terminal closing after outputting code result
I'm new to coding, and I'm trying to use VS code to learn Python. I had an issue when I ran the debugger. I got some extra output showing something like this:
PS C:\Users\user\Desktop\Python\oops> ...
6
votes
1
answer
6k
views
Why does `py.test --last-failed` skip many tests although no tests had failed before?
Out of sudden, py.test --last-failed skips a lot of tests although no test failed in a previous test run. Here is the output of first running py.test --vv and then py.test --vv --last-failed:
venv/bin/...
1
vote
1
answer
26
views
Distributed computing with Ray/Python has no parallelism at all on GCP
I am trying to setup a distributed environment for NLP processing. I use Ray and Python on GCP. I have a master and several workers. What happens is that when I run 1 worker or 8 workers, it takes ...
Best practices
0
votes
1
replies
21
views
Namespace tracking best practices
I'm new. Is it best practice to make a list of the variable's "namespace," and if so, what are some of the methods to track them that others might use? Are there other things that should be ...
1
vote
1
answer
27
views
Tensorflow Keras CV tutorials incorrectly working
I have an intersting error. I'm starting learning Machine Learning by Tensorflow Keras CV tutorials and two of my tutorial projects working incorrectly
I use this tutorials:
https://www.tensorflow.org/...