qid int64 46k 74.7M | question stringlengths 54 37.8k | date stringlengths 10 10 | metadata listlengths 3 3 | response_j stringlengths 17 26k | response_k stringlengths 26 26k |
|---|---|---|---|---|---|
68,992,767 | I'm trying to implement selection sort in python using a list. But the implementation part is correct and is as per my algorithm but it is not resulting in correct output. Adding my code:
```
my_list = [64, 25, 12, 11, 32]
def selection_sort(element_list):
for element in range(len(element_list)):
mindex =... | 2021/08/31 | [
"https://Stackoverflow.com/questions/68992767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12116796/"
] | Your algorithm is almost correct but
`element_list[compare_index], element_list[mindex] = element_list[mindex], element_list[compare_index]` in this line you made the mistake.
It shouldn't be `compare_index`, it should be `element`. Please check the correct algorithm below
```
my_list = [64, 25, 12, 11, 32]
def selec... | I think the problem lies in the line
`element_list[compare_index], element_list[mindex] = element_list[mindex], element_list[compare_index]`
Here I believe you want to exchange the position of the bigger and the smaller number in the array, but the problem is that you are exchanging the positions of the elements with... |
68,992,767 | I'm trying to implement selection sort in python using a list. But the implementation part is correct and is as per my algorithm but it is not resulting in correct output. Adding my code:
```
my_list = [64, 25, 12, 11, 32]
def selection_sort(element_list):
for element in range(len(element_list)):
mindex =... | 2021/08/31 | [
"https://Stackoverflow.com/questions/68992767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12116796/"
] | ```
my_list = [64, 25, 12, 11, 32]
def selection_sort(element_list):
for element in range(len(element_list)):
mindex = element
for compare_index in range(element+1, len(element_list)):
if element_list[mindex] > element_list[compare_index]:
min... | I think the problem lies in the line
`element_list[compare_index], element_list[mindex] = element_list[mindex], element_list[compare_index]`
Here I believe you want to exchange the position of the bigger and the smaller number in the array, but the problem is that you are exchanging the positions of the elements with... |
8,733,807 | >
> **Possible Duplicate:**
>
> [Is there a java equivalent of the python eval function?](https://stackoverflow.com/questions/7143343/is-there-a-java-equivalent-of-the-python-eval-function)
>
>
>
There is a String, something like `String str = "if a[0]=1 & a[1]=2"`. How to use this string in a real IF THEN exp... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8733807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1089623/"
] | Java isn't a scripting language that supports dynamic evaluation (although it does support script execution). I would challenge you to check to see if what you're attempting to do is being done in the right way within Java.
There are two common ways you can approach this, listed below. However they have a significant ... | I don't think you can do what you're asking.
Also your java doesn't seem to make much sense. Something like this would make more sense:
```
for (Integer a : myNumbers) {
if (a.equals(Integer.valueOf(1))){
//...
}
}
```
You can however say:
```
if("hello".equals("world")){
//...
}
```
And you can ... |
70,461,539 | I have created a list of dictionaries of named tuples, keyed with an event type.
```
[{'EVENT_DELETE': DeleteRequestDetails(rid=53421, user='user1', type='EVENT_DELETE', reviewed=1, approved=1, completed=0)},{'EVENT_DELETE': DeleteRequestDetails(rid=13423, user='user2', type='EVENT_DELETE', reviewed=1, approved=1, com... | 2021/12/23 | [
"https://Stackoverflow.com/questions/70461539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713151/"
] | Also you can trigger a link by JavaScript.
```
<button
onclick="window.location(this.getAttribute('data-link'))"
data-link="/hello">go to hello</button>
``` | One way could be to use an anchor tag instead of the button and make it look like a button.
HTML:
```html
<div class="buttons">
<a class="btn custom-btn position-bottom-right"> Add to cart</a>
</div>
```
CSS:
```css
.custom-btn {
border: medium dashed green;
}
```
Alternatively, you could do:
```
<button cl... |
70,461,539 | I have created a list of dictionaries of named tuples, keyed with an event type.
```
[{'EVENT_DELETE': DeleteRequestDetails(rid=53421, user='user1', type='EVENT_DELETE', reviewed=1, approved=1, completed=0)},{'EVENT_DELETE': DeleteRequestDetails(rid=13423, user='user2', type='EVENT_DELETE', reviewed=1, approved=1, com... | 2021/12/23 | [
"https://Stackoverflow.com/questions/70461539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713151/"
] | Also you can trigger a link by JavaScript.
```
<button
onclick="window.location(this.getAttribute('data-link'))"
data-link="/hello">go to hello</button>
``` | You can use the anchor tag and provide a [Bootstrap](https://en.wikipedia.org/wiki/Bootstrap_%28front-end_framework%29) class for the button, like,
```
<a class="btn btn-success" href="link"> Add to Cart</a>
``` |
70,461,539 | I have created a list of dictionaries of named tuples, keyed with an event type.
```
[{'EVENT_DELETE': DeleteRequestDetails(rid=53421, user='user1', type='EVENT_DELETE', reviewed=1, approved=1, completed=0)},{'EVENT_DELETE': DeleteRequestDetails(rid=13423, user='user2', type='EVENT_DELETE', reviewed=1, approved=1, com... | 2021/12/23 | [
"https://Stackoverflow.com/questions/70461539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713151/"
] | Also you can trigger a link by JavaScript.
```
<button
onclick="window.location(this.getAttribute('data-link'))"
data-link="/hello">go to hello</button>
``` | Try this:
```html
<a href='http://my-link.com'>
<button class="GFG">
Click Here
</button>
</a>
``` |
70,461,539 | I have created a list of dictionaries of named tuples, keyed with an event type.
```
[{'EVENT_DELETE': DeleteRequestDetails(rid=53421, user='user1', type='EVENT_DELETE', reviewed=1, approved=1, completed=0)},{'EVENT_DELETE': DeleteRequestDetails(rid=13423, user='user2', type='EVENT_DELETE', reviewed=1, approved=1, com... | 2021/12/23 | [
"https://Stackoverflow.com/questions/70461539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713151/"
] | Also you can trigger a link by JavaScript.
```
<button
onclick="window.location(this.getAttribute('data-link'))"
data-link="/hello">go to hello</button>
``` | If the label "Add to cart" matches the expectations, we'd be talking about a form. A form that causes an element to be added typically uses the [POST](https://en.wikipedia.org/wiki/POST_%28HTTP%29) method:
```
<form class="buttons" method="post" action="/path/to/add/to/cart/script">
<input type="hidden" name="produc... |
72,335,222 | EDIT2:
------
A minimal demonstration is:
```
code = """\
a=1
def f1():
print(a)
print(f1.__closure__)
f1()
"""
def foo():
exec(code)
foo()
```
Which gives:
```
None
Traceback (most recent call last):
File "D:/workfiles/test_eval_rec.py", line 221, in <module>
foo()
File "D:/workfiles//test_eval_... | 2022/05/22 | [
"https://Stackoverflow.com/questions/72335222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9758790/"
] | **Using Exec**
You've already covered most of the problems and workarounds with `exec`, but I feel that there is still value in adding a summary.
The key issue is that `exec` only knows about `globals` and `locals`, but not about free variables and the non-local namespace. That is why the [docs](https://docs.python.o... | **Why this phenomena happen:**
Actually [the answer](https://stackoverflow.com/a/2749806/9758790) of the [question 4](https://stackoverflow.com/q/2749655/9758790) listed above can answer this question.
When call `exec()` on one code string, the code string is first compiled. I suppose that during compiling, the provi... |
72,335,222 | EDIT2:
------
A minimal demonstration is:
```
code = """\
a=1
def f1():
print(a)
print(f1.__closure__)
f1()
"""
def foo():
exec(code)
foo()
```
Which gives:
```
None
Traceback (most recent call last):
File "D:/workfiles/test_eval_rec.py", line 221, in <module>
foo()
File "D:/workfiles//test_eval_... | 2022/05/22 | [
"https://Stackoverflow.com/questions/72335222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9758790/"
] | **Using Exec**
You've already covered most of the problems and workarounds with `exec`, but I feel that there is still value in adding a summary.
The key issue is that `exec` only knows about `globals` and `locals`, but not about free variables and the non-local namespace. That is why the [docs](https://docs.python.o... | TL;DR
-----
To set correct `__closure__` attribute of function defined in the code string passed to `exec()` function. Just wrap the total code string with a function definition.
I provide an example here to demonstrate all possible situations. Suppose you want to define a function named `foo` inside a code string us... |
23,244,245 | I have developed an application which uses udisks version 1 to find and list details of connected USB drives. The details include device (/dev/sdb1...etc), mount point, and free space. However, I found that modern distros has udisks2 installed by default. Here is the little code found on the other SO thread:-
```
#!/u... | 2014/04/23 | [
"https://Stackoverflow.com/questions/23244245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2221360/"
] | After lot of hit and trial, I could get what I wanted. Just posting it so that some one can benefit in the future. Here is the code:-
```
#!/usr/bin/python2.7
# coding: utf-8
import dbus
def get_usb():
devices = []
bus = dbus.SystemBus()
ud_manager_obj = bus.get_object('org.freedesktop.UDisks2', '/org/fre... | **Edit**
Note that the `Block` object does not have `ConnectionBus` or `Removable` properties. You will have to change the code to remove references to `Drive` object properties for the code to work.
**/Edit**
If you want to connect to `Block`, not `Drive`, then instead of
```
drive_info = v.get('org.freedesktop.UD... |
61,448,722 | I have a python function that outputs/prints the following:
```
['CN=*.something1.net', 'CN=*.something2.net', 'CN=*.something4.net', 'CN=something6.net', 'CN=something8.net', 'CN=intranet.something89.net', 'CN=intranet.something111.net, 'OU=PositiveSSL Multi-Domain, CN=something99.net', 'OU=Domain Control Validated, ... | 2020/04/26 | [
"https://Stackoverflow.com/questions/61448722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3704597/"
] | The last single quote is indicating the end of the string, so it seems you just want everything after `CN=`. Assuming that's the case, you can just chop off the first three characters:
```
subdomains = [item[3:] for item in my_list if item.startswith('CN=')]
``` | Here is a more readable code that extracts the subdomains in more clean or better way;
@tzaman code didn't really give me subdomains.
```
myDirtyDomains = ['CN=*.something1.net', 'CN=*.something2.net', 'CN=*.something4.net',\
'CN=something6.net', 'CN=something8.net', 'CN=intranet.something89.net',\
'CN=intranet.somet... |
61,448,722 | I have a python function that outputs/prints the following:
```
['CN=*.something1.net', 'CN=*.something2.net', 'CN=*.something4.net', 'CN=something6.net', 'CN=something8.net', 'CN=intranet.something89.net', 'CN=intranet.something111.net, 'OU=PositiveSSL Multi-Domain, CN=something99.net', 'OU=Domain Control Validated, ... | 2020/04/26 | [
"https://Stackoverflow.com/questions/61448722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3704597/"
] | The last single quote is indicating the end of the string, so it seems you just want everything after `CN=`. Assuming that's the case, you can just chop off the first three characters:
```
subdomains = [item[3:] for item in my_list if item.startswith('CN=')]
``` | If you just want to strip `CN=` from each string, you can strip from the left with [`str.lstrip()`](https://docs.python.org/3/library/stdtypes.html#str.lstrip):
```
subdomains = [item.lstrip("CN=") for item in my_list]
``` |
50,283,776 | I am writing a python script and i want to execute some code only if the python script is being run directly from terminal and not from any another script.
How to do this in Ubuntu without using any extra command line arguments .?
The answer in here **DOESN't WORK**:
[Determine if the program is called from a script ... | 2018/05/11 | [
"https://Stackoverflow.com/questions/50283776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6665568/"
] | You should probably be using command-line arguments instead, but this *is* doable. Simply check if the current process is the process group leader:
```
$ sh -c 'echo shell $$; python3 -c "import os; print(os.getpid.__name__, os.getpid()); print(os.getpgid.__name__, os.getpgid(0)); print(os.getsid.__name__, os.getsid(0... | I recommend using command-line arguments.
**script.sh**
```sh
./testpython.py --from-script
```
**testpython.py**
```
import sys
if "--from-script" in sys.argv:
# From script
else:
# Not from script
``` |
42,289,722 | I have the python code where I pass the json file
```
def home():
with open('file.json', 'a+') as f:
return render_template('index.html', json_data=f.read())
```
The file look like this
```
{"hosts": [{"shortname": "serv1", "ipadr": "10.0.0.1", "longname": "server1"}, {"shortname": "serv2", "ipadr": "10... | 2017/02/17 | [
"https://Stackoverflow.com/questions/42289722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7528895/"
] | Try this : Here `DATEADD(yy, DATEDIFF(yy,0,getdate())` will give start month of the year
```
DA.Access_Date >= DATEADD(YEAR, -2, DATEADD(YY, DATEDIFF(YY,0,GETDATE()), 0))
``` | Your condition should be like below. `DATEADD(YEAR,DATEDIFF(YEAR, 0, GETDATE())-2,0)` this will returns first day of `2015` year.
```
DA.Access_Date >= DATEADD(YEAR,DATEDIFF(YEAR, 0, GETDATE())-2,0)
``` |
42,289,722 | I have the python code where I pass the json file
```
def home():
with open('file.json', 'a+') as f:
return render_template('index.html', json_data=f.read())
```
The file look like this
```
{"hosts": [{"shortname": "serv1", "ipadr": "10.0.0.1", "longname": "server1"}, {"shortname": "serv2", "ipadr": "10... | 2017/02/17 | [
"https://Stackoverflow.com/questions/42289722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7528895/"
] | Try this : Here `DATEADD(yy, DATEDIFF(yy,0,getdate())` will give start month of the year
```
DA.Access_Date >= DATEADD(YEAR, -2, DATEADD(YY, DATEDIFF(YY,0,GETDATE()), 0))
``` | With the help of **YEAR** scalar function
```
WHERE
YEAR(DA.Access_Date) in (YEAR(GETDATE()),YEAR(GETDATE())-1,YEAR(GETDATE())-2)
``` |
42,289,722 | I have the python code where I pass the json file
```
def home():
with open('file.json', 'a+') as f:
return render_template('index.html', json_data=f.read())
```
The file look like this
```
{"hosts": [{"shortname": "serv1", "ipadr": "10.0.0.1", "longname": "server1"}, {"shortname": "serv2", "ipadr": "10... | 2017/02/17 | [
"https://Stackoverflow.com/questions/42289722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7528895/"
] | Try this : Here `DATEADD(yy, DATEDIFF(yy,0,getdate())` will give start month of the year
```
DA.Access_Date >= DATEADD(YEAR, -2, DATEADD(YY, DATEDIFF(YY,0,GETDATE()), 0))
``` | Just compare the year.
Try
```
YEAR(DA.Access_Date) >= (YEAR(GETDATE()) - 2)
``` |
42,289,722 | I have the python code where I pass the json file
```
def home():
with open('file.json', 'a+') as f:
return render_template('index.html', json_data=f.read())
```
The file look like this
```
{"hosts": [{"shortname": "serv1", "ipadr": "10.0.0.1", "longname": "server1"}, {"shortname": "serv2", "ipadr": "10... | 2017/02/17 | [
"https://Stackoverflow.com/questions/42289722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7528895/"
] | Try this : Here `DATEADD(yy, DATEDIFF(yy,0,getdate())` will give start month of the year
```
DA.Access_Date >= DATEADD(YEAR, -2, DATEADD(YY, DATEDIFF(YY,0,GETDATE()), 0))
``` | You should try this in where condition.
Year(DA.Access\_Date) >= Year(getdate()) - 2 |
60,945,866 | I've created flask app and try to dockerize it. It uses machine learning libraries, I had some problems with download it so my Dockerfile is a little bit messy, but Image was succesfully created.
```
from alpine:latest
RUN apk add --no-cache python3-dev \
&& pip3 install --upgrade pip
WORKDIR /app
COPY . /app
FROM... | 2020/03/31 | [
"https://Stackoverflow.com/questions/60945866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9802634/"
] | The problem is here:
`RUN pip3 freeze > requirements.txt`
The `>` operator in bash overwrites the content of the file. If you want to append to your `requirements.txt`, consider using `>>` operator:
`RUN pip3 freeze >> requirements.txt` | Thank you All. Finally I rebuilded my app, simplified requirements, exclude alpine and use python 3.7 in my Dockerfile.
I could run app locally, but Docker probably could not find some file from path, or get some other error from app, that is why it stopped just after starting. |
43,648,081 | I have a pickle file that was created with python 2.7 that I'm trying to port to python 3.6. The file is saved in py 2.7 via `pickle.dumps(self.saved_objects, -1)`
and loaded in python 3.6 via `loads(data, encoding="bytes")` (from a file opened in `rb` mode). If I try opening in `r` mode and pass `encoding=latin1` to ... | 2017/04/27 | [
"https://Stackoverflow.com/questions/43648081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2682863/"
] | In short, you're hitting [bug 22005](http://bugs.python.org/issue22005) with `datetime.date` objects in the `RentalDetails` objects.
That can be worked around with the `encoding='bytes'` parameter, but that leaves your classes with `__dict__` containing bytes:
```
>>> library = pickle.loads(pickle_data, encoding='byt... | >
> **Question**: Porting pickle py2 to py3 strings become bytes
>
>
>
The given `encoding='latin-1'` below, is ok.
Your Problem with `b''` are the result of using `encoding='bytes'`.
This will result in dict-keys being unpickled as bytes instead of as str.
The Problem data are the `datetime.date values '\x07... |
43,648,081 | I have a pickle file that was created with python 2.7 that I'm trying to port to python 3.6. The file is saved in py 2.7 via `pickle.dumps(self.saved_objects, -1)`
and loaded in python 3.6 via `loads(data, encoding="bytes")` (from a file opened in `rb` mode). If I try opening in `r` mode and pass `encoding=latin1` to ... | 2017/04/27 | [
"https://Stackoverflow.com/questions/43648081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2682863/"
] | In short, you're hitting [bug 22005](http://bugs.python.org/issue22005) with `datetime.date` objects in the `RentalDetails` objects.
That can be worked around with the `encoding='bytes'` parameter, but that leaves your classes with `__dict__` containing bytes:
```
>>> library = pickle.loads(pickle_data, encoding='byt... | You should treat `pickle` data as specific to the (major) version of Python that created it.
(See [Gregory Smith's message w.r.t. issue 22005](http://bugs.python.org/issue22005#msg288821).)
The best way to get around this is to write a Python 2.7 program to read the pickled data, and write it out in a neutral format.... |
26,963,534 | I'm trying to complete a dice game python (3.4) programming assignment for school and I'm having some trouble passing a variable from one function to another using a return statement, but when I run the program the variable "diesum" is interpreted as undefined.
```
import random
def RollDice():
die1 = random.rand... | 2014/11/16 | [
"https://Stackoverflow.com/questions/26963534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4259262/"
] | You are not passing the result of `RollDice` into `Craps`. Try this instead:
```
result = RollDice()
Craps(result)
```
There are some other issues in the snippet that you have pasted, but this is the main reason that your are seeing an error. The `return` statement returns a value from a function. You need to bind t... | There are many reasons since it does not work.. first simplify the problem! This is a working initial example:
```
import random
def RollDice():
die1 = random.randint(1, 6)
die2 = random.randint(1, 6)
diesum = die1 + die2
print(diesum)
return diesum
def Craps(diesum):
craps = [2, 3, 12]
n... |
64,575,063 | ```
import pandas as pd
data = pd.read_excel (r'C:\Users\royli\Downloads\Product List.xlsx',sheet_name='Sheet1' )
df = pd.DataFrame(data, columns= ['Product'])
print (df)
```
*****Error Message*****
```
Traceback (most recent call last):
File "main.py", line 3, in <module>
Traceback (most recent call last):
Fi... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64575063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14526349/"
] | There are 3 ways to solve this:
1. If the git repository is on your Windows machine, [configure Beyond Compare as an external difftool](https://www.scootersoftware.com/support.php?zz=kb_vcs#gitwindows), then run
`git difftool --dir-diff` to launch a diff in the Folder Compare.
2. If you can install Beyond Compare for ... | I just faced a similar problem, and wrote a script to allow using Beyond Compare as a Git difftool, with BC being installed locally, and the Git workspace residing on a remote machine: <https://github.com/mbikovitsky/beyond-ssh>. |
69,792,060 | I'm fairly new to programming in general and have been learning python3 for the last week or so. I tried building a dice roller and ran into an issue when asking the user if they wanted to repeat the roller or end the program.
```
import random as dice
d100 = dice.randint(1,100)
d20 = dice.randint(1,20)
d10 = dice.ra... | 2021/11/01 | [
"https://Stackoverflow.com/questions/69792060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17296020/"
] | It's a problem of precedence: `repeat == 'Y' or 'y' or 'yes' or 'Yes'` is interpreted as `(repeat == 'Y') or 'y' or 'yes' or 'Yes'` and then it tries to check whether `'y'` counts as true, which it does (it's a non-empty string).
What you want is `while repeat in ('Y', 'y', 'yes', 'Yes'):`
By the way, you don't need ... | Two things
`continue` means go to the top of the loop (and then check whether to re-enter it), not guaranteed to go through the loop again. It might be better named skip because it really means "skip the rest of this iteration". Hence you don't need `if ... continue` because you're already at the end of the iteration.... |
71,164,536 | I'm just trying to make a very simple entry widget and grid it on the window but I keep getting an error. Anyway I can fix it?
code:
```
e = tk.Entry(root, borderwidth=5, width=35)
e.grid(root, row=0,column=0, columnspan=3, padx=10, pady=10)
```
Error:
```
Traceback (most recent call last):
File "C:\Users\mosta... | 2022/02/17 | [
"https://Stackoverflow.com/questions/71164536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You need to remove the argument `root` from the `grid` command.
```
e.grid(row=0,column=0, columnspan=3, padx=10, pady=10)
``` | By using the .place() method instead of the .grid() method, I have successfully gotten the Entry widget to work.
```
from tkinter import *
root = Tk()
e = Entry(root, borderwidth=5)
e.place(x=10, y=10, height=25, width=180)
```
I hope that this helps :-) |
26,313,761 | I know that [**si**](https://stackoverflow.com/questions/12160766/install-packages-with-portable-python "One Stack Overflow question.")[*mi*](https://stackoverflow.com/questions/16754614/adding-libraries-to-portable-python?rq=1 "Another Stack Overflow question.")[**la**](https://stackoverflow.com/questions/13119671/pyg... | 2014/10/11 | [
"https://Stackoverflow.com/questions/26313761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3787376/"
] | Implement your `Oggetto` class using standard JavaFX Properties:
```
import javafx.beans.property.BooleanProperty ;
import javafx.beans.property.IntegerProperty ;
import javafx.beans.property.SimpleBooleanProperty ;
import javafx.beans.property.SimpleIntegerProperty ;
public class Oggetto {
private final Integer... | ```
import javafx.beans.InvalidationListener;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
public class VerySimply implements ObservableValue<Integer> {
private int newValue;
public ChangeListener<Integer> listener = new ChangeListener<Integer>() {
@Override
... |
60,493,027 | I am reading the book Hacking: The art of exploitation and there is a format string exploit example which attempts to overwrite an address of the dtors
with the address of a shellcode environment variable.
I work on Kali Linux 64-bit and already found out that there are no dtors (destructors of a c program) and so now ... | 2020/03/02 | [
"https://Stackoverflow.com/questions/60493027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12737461/"
] | Relocations and low addresses like this one:
```
0000000000003de8 R_X86_64_RELATIVE *ABS*+0x0000000000001170
```
suggest that the executable has been built as PIE (position-independent executable), with full address space layout randomization (ASLR). This means that the addresses do not match the static view from `... | Probably, you can use 「-Wl,-z,norelro」 to disable RELRO. |
7,097,058 | >
> **Possible Duplicate:**
>
> [How to convert strings into integers in python?](https://stackoverflow.com/questions/642154/how-to-convert-strings-into-integers-in-python)
>
>
>
I need to change a list of strings into a list of integers how do i do this
i.e
('1', '1', '1', '1', '2') into (1,1,1,1,2). | 2011/08/17 | [
"https://Stackoverflow.com/questions/7097058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/899084/"
] | Use [list comprehensions](http://docs.python.org/tutorial/datastructures.html#list-comprehensions):
```
strtuple = ('1', '1', '1', '1', '2')
intlist = [int(s) for s in strtuple]
```
Stuff for completeness:
=======================
As your “list” is in truth a [tuple](http://docs.python.org/library/stdtypes.html#type... | Use the `map` function.
```
vals = ('1', '1', '1', '1', '2')
result = tuple(map(int, vals))
print result
```
Output:
```
(1, 1, 1, 1, 2)
```
A performance comparison with the list comprehension:
```
from timeit import timeit
print timeit("map(int, vals)", "vals = '1', '2', '3', '4'")
print timeit("[int(s) for s ... |
7,097,058 | >
> **Possible Duplicate:**
>
> [How to convert strings into integers in python?](https://stackoverflow.com/questions/642154/how-to-convert-strings-into-integers-in-python)
>
>
>
I need to change a list of strings into a list of integers how do i do this
i.e
('1', '1', '1', '1', '2') into (1,1,1,1,2). | 2011/08/17 | [
"https://Stackoverflow.com/questions/7097058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/899084/"
] | Use [list comprehensions](http://docs.python.org/tutorial/datastructures.html#list-comprehensions):
```
strtuple = ('1', '1', '1', '1', '2')
intlist = [int(s) for s in strtuple]
```
Stuff for completeness:
=======================
As your “list” is in truth a [tuple](http://docs.python.org/library/stdtypes.html#type... | You could use list comprehension which would look roughly like:
```
newList = [int(x) for x in oldList]
``` |
7,097,058 | >
> **Possible Duplicate:**
>
> [How to convert strings into integers in python?](https://stackoverflow.com/questions/642154/how-to-convert-strings-into-integers-in-python)
>
>
>
I need to change a list of strings into a list of integers how do i do this
i.e
('1', '1', '1', '1', '2') into (1,1,1,1,2). | 2011/08/17 | [
"https://Stackoverflow.com/questions/7097058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/899084/"
] | Use [list comprehensions](http://docs.python.org/tutorial/datastructures.html#list-comprehensions):
```
strtuple = ('1', '1', '1', '1', '2')
intlist = [int(s) for s in strtuple]
```
Stuff for completeness:
=======================
As your “list” is in truth a [tuple](http://docs.python.org/library/stdtypes.html#type... | ```
map(int, ls)
```
Where `ls` is your list of strings. |
7,097,058 | >
> **Possible Duplicate:**
>
> [How to convert strings into integers in python?](https://stackoverflow.com/questions/642154/how-to-convert-strings-into-integers-in-python)
>
>
>
I need to change a list of strings into a list of integers how do i do this
i.e
('1', '1', '1', '1', '2') into (1,1,1,1,2). | 2011/08/17 | [
"https://Stackoverflow.com/questions/7097058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/899084/"
] | Use the `map` function.
```
vals = ('1', '1', '1', '1', '2')
result = tuple(map(int, vals))
print result
```
Output:
```
(1, 1, 1, 1, 2)
```
A performance comparison with the list comprehension:
```
from timeit import timeit
print timeit("map(int, vals)", "vals = '1', '2', '3', '4'")
print timeit("[int(s) for s ... | You could use list comprehension which would look roughly like:
```
newList = [int(x) for x in oldList]
``` |
7,097,058 | >
> **Possible Duplicate:**
>
> [How to convert strings into integers in python?](https://stackoverflow.com/questions/642154/how-to-convert-strings-into-integers-in-python)
>
>
>
I need to change a list of strings into a list of integers how do i do this
i.e
('1', '1', '1', '1', '2') into (1,1,1,1,2). | 2011/08/17 | [
"https://Stackoverflow.com/questions/7097058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/899084/"
] | ```
map(int, ls)
```
Where `ls` is your list of strings. | You could use list comprehension which would look roughly like:
```
newList = [int(x) for x in oldList]
``` |
429,648 | Is there a library to do pretty on screen display with Python (mainly on Linux but preferably available on other OS too) ? I know there is python-osd but it uses [libxosd](http://sourceforge.net/projects/libxosd) which looks quite old. I would not call it *pretty*.
Maybe a Python binding for [libaosd](http://cia.vc/st... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49808/"
] | Actually, xosd isn't all that old; I went to university with the original author (Andre Renaud, who is a superlative programmer). It is quite low level, but pretty simple - xosd.c is only 1365 lines long. It wouldn't be hard to tweak it to display pretty much anything you want. | Using PyGTK on X it's possible to scrape the screen background and composite the image with a standard Pango layout.
I have some code that does this at <http://svn.sacredchao.net/svn/quodlibet/trunk/plugins/events/animosd.py>. It's a bit ugly and long, but mostly straightforward. |
429,648 | Is there a library to do pretty on screen display with Python (mainly on Linux but preferably available on other OS too) ? I know there is python-osd but it uses [libxosd](http://sourceforge.net/projects/libxosd) which looks quite old. I would not call it *pretty*.
Maybe a Python binding for [libaosd](http://cia.vc/st... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49808/"
] | Actually, xosd isn't all that old; I went to university with the original author (Andre Renaud, who is a superlative programmer). It is quite low level, but pretty simple - xosd.c is only 1365 lines long. It wouldn't be hard to tweak it to display pretty much anything you want. | Building upon the answer from @user79758, the `animosd.py` link in that post is no longer available, but this one still is: <http://hefesto.intra.ial.sp.gov.br/share/pyshared/quodlibet/plugins/events/animosd.py> ([archive](http://web.archive.org/web/20190711182113/http://hefesto.intra.ial.sp.gov.br/share/pyshared/quodl... |
429,648 | Is there a library to do pretty on screen display with Python (mainly on Linux but preferably available on other OS too) ? I know there is python-osd but it uses [libxosd](http://sourceforge.net/projects/libxosd) which looks quite old. I would not call it *pretty*.
Maybe a Python binding for [libaosd](http://cia.vc/st... | 2009/01/09 | [
"https://Stackoverflow.com/questions/429648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49808/"
] | Using PyGTK on X it's possible to scrape the screen background and composite the image with a standard Pango layout.
I have some code that does this at <http://svn.sacredchao.net/svn/quodlibet/trunk/plugins/events/animosd.py>. It's a bit ugly and long, but mostly straightforward. | Building upon the answer from @user79758, the `animosd.py` link in that post is no longer available, but this one still is: <http://hefesto.intra.ial.sp.gov.br/share/pyshared/quodlibet/plugins/events/animosd.py> ([archive](http://web.archive.org/web/20190711182113/http://hefesto.intra.ial.sp.gov.br/share/pyshared/quodl... |
64,090,872 | I have a for loop in Pygame that is trying to slowly progress through a string, like how text scrolls in RPGs. I want it to wait around 7 milliseconds before displaying the next character in the string, but I don't know how to make the loop wait that long without stopping other stuff.
Please note that I am very new to ... | 2020/09/27 | [
"https://Stackoverflow.com/questions/64090872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14089022/"
] | You don't need the `for` loop at all. You have an application loop, so use it. The number of milliseconds since `pygame.init()` can be retrieved by [`pygame.time.get_ticks()`](https://www.pygame.org/docs/ref/time.html#pygame.time.get_ticks). See [`pygame.time`](https://www.pygame.org/docs/ref/time.html) module.
```py
... | use this
```
@coroutine
def my_func():
from time import sleep
mainText = pygame.font.Font(mainFont, 40)
finalMessage = ""
for letter in msg:
finalMessage = finalMessage + letter
renderMainText = mainText.render(finalMessage, True, white)
screen.blit(renderMainText, (100, 100))
... |
60,775,172 | I used pyenv to install python 3.8.2 and to create a virtualenv.
In the virtualenv, I used pipenv to install `pandas`.
However, when importing pandas, I'm getting the following:
```
[...]
File "/home/luislhl/.pyenv/versions/poc-prefect/lib/python3.8/site-packages/pandas/io/common.py", line 3, in <module>
impo... | 2020/03/20 | [
"https://Stackoverflow.com/questions/60775172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3477266/"
] | On macOS Big Sur, to get pyenv ( via homebrew ) to work I had to install zlib and bzip2 via homebrew and then add the exports in my ~/.zshrc ( or ~/.bashrc for bash I guess). The answer above [by luislhl](https://stackoverflow.com/q/60775172/2117661) leads the way to my solution.
```
brew install zlib bzip2
#Add the ... | Ok, I have found the solution after some time. It was simple, but I took some time to realize it.
It turns out the problem was the `bzip2-devel` I had installed was a 32-bit version.
The compilation process was looking for the 64-bit one, and didn't find it.
So I had to specifically install the 64-bit version:
```
s... |
60,775,172 | I used pyenv to install python 3.8.2 and to create a virtualenv.
In the virtualenv, I used pipenv to install `pandas`.
However, when importing pandas, I'm getting the following:
```
[...]
File "/home/luislhl/.pyenv/versions/poc-prefect/lib/python3.8/site-packages/pandas/io/common.py", line 3, in <module>
impo... | 2020/03/20 | [
"https://Stackoverflow.com/questions/60775172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3477266/"
] | On Ubuntu 22 LTS
### Missing Library Problem in Python Installation with Pyenv
Before the fix:
```
$> pyenv install 3.11.0
```
command result:
```
pyenv: /home/user/.pyenv/versions/3.11.0 already exists
continue with installation? (y/N) y
Downloading Python-3.11.0.tar.xz...
-> https://www.python.org/ftp/python/3.... | Ok, I have found the solution after some time. It was simple, but I took some time to realize it.
It turns out the problem was the `bzip2-devel` I had installed was a 32-bit version.
The compilation process was looking for the 64-bit one, and didn't find it.
So I had to specifically install the 64-bit version:
```
s... |
60,775,172 | I used pyenv to install python 3.8.2 and to create a virtualenv.
In the virtualenv, I used pipenv to install `pandas`.
However, when importing pandas, I'm getting the following:
```
[...]
File "/home/luislhl/.pyenv/versions/poc-prefect/lib/python3.8/site-packages/pandas/io/common.py", line 3, in <module>
impo... | 2020/03/20 | [
"https://Stackoverflow.com/questions/60775172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3477266/"
] | On macOS Big Sur, to get pyenv ( via homebrew ) to work I had to install zlib and bzip2 via homebrew and then add the exports in my ~/.zshrc ( or ~/.bashrc for bash I guess). The answer above [by luislhl](https://stackoverflow.com/q/60775172/2117661) leads the way to my solution.
```
brew install zlib bzip2
#Add the ... | Thanks, that helped, just with small modification in `~/.zshrc`:
```
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/bzip2/lib"
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/bzip2/include"
```
and then `pyenv install 3.7.9`
---
`Apple M1`, `macOS 11.1 20C69 arm64`;
```
➜ b... |
60,775,172 | I used pyenv to install python 3.8.2 and to create a virtualenv.
In the virtualenv, I used pipenv to install `pandas`.
However, when importing pandas, I'm getting the following:
```
[...]
File "/home/luislhl/.pyenv/versions/poc-prefect/lib/python3.8/site-packages/pandas/io/common.py", line 3, in <module>
impo... | 2020/03/20 | [
"https://Stackoverflow.com/questions/60775172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3477266/"
] | On macOS Big Sur, to get pyenv ( via homebrew ) to work I had to install zlib and bzip2 via homebrew and then add the exports in my ~/.zshrc ( or ~/.bashrc for bash I guess). The answer above [by luislhl](https://stackoverflow.com/q/60775172/2117661) leads the way to my solution.
```
brew install zlib bzip2
#Add the ... | On Ubuntu 22 LTS
### Missing Library Problem in Python Installation with Pyenv
Before the fix:
```
$> pyenv install 3.11.0
```
command result:
```
pyenv: /home/user/.pyenv/versions/3.11.0 already exists
continue with installation? (y/N) y
Downloading Python-3.11.0.tar.xz...
-> https://www.python.org/ftp/python/3.... |
60,775,172 | I used pyenv to install python 3.8.2 and to create a virtualenv.
In the virtualenv, I used pipenv to install `pandas`.
However, when importing pandas, I'm getting the following:
```
[...]
File "/home/luislhl/.pyenv/versions/poc-prefect/lib/python3.8/site-packages/pandas/io/common.py", line 3, in <module>
impo... | 2020/03/20 | [
"https://Stackoverflow.com/questions/60775172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3477266/"
] | On Ubuntu 22 LTS
### Missing Library Problem in Python Installation with Pyenv
Before the fix:
```
$> pyenv install 3.11.0
```
command result:
```
pyenv: /home/user/.pyenv/versions/3.11.0 already exists
continue with installation? (y/N) y
Downloading Python-3.11.0.tar.xz...
-> https://www.python.org/ftp/python/3.... | Thanks, that helped, just with small modification in `~/.zshrc`:
```
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/bzip2/lib"
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/bzip2/include"
```
and then `pyenv install 3.7.9`
---
`Apple M1`, `macOS 11.1 20C69 arm64`;
```
➜ b... |
59,118,639 | On a **Ubuntu 18.04** machine I am trying to use **opencv 4.1.2** [facedetect](https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/gst-plugins-bad-plugins-facedetect.html) in a **gstreamer 1.14.5** pipeline but unfortunately the plugin is not installed.
I downloaded the gstreamer [bad plugin... | 2019/11/30 | [
"https://Stackoverflow.com/questions/59118639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431063/"
] | Please don't dirty your Ubuntu. Prefer using any package manager in Ubuntu, that you like. If you use `apt`, just install ready and available package for you:
```
sudo apt install libgstreamer-plugins-bad1.0-dev
``` | I had the same problem, and my solution is if you want to use the GStreamer OpenCV Plugins described [here](https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/gst-plugins-bad-plugins-plugin-opencv.html) and [here](https://gstreamer.freedesktop.org/documentation/opencv/?gi-language=c) you nee... |
57,502,112 | I am getting an attribute error while running the code given below:
```py
import base64
import subprocess
from __future__ import absolute_import, print_function
from pprint import pprint
import unittest
import webbrowser
import docusign_esign as docusign
from docusign_esign import AuthenticationApi, TemplatesApi,Envel... | 2019/08/14 | [
"https://Stackoverflow.com/questions/57502112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11929301/"
] | >
> this html code was built automatically by jquery so I can't add id or "onlick" event on this tag
>
>
>
If you can't control when that happens, you can still use event delegation to get involved in the click event:
```
$(document).on('click', '.fc-day-grid-event', function() {
...//
});
```
That works even i... | ```
<a onclick="doStuff(this)">Click Me</a>
``` |
57,502,112 | I am getting an attribute error while running the code given below:
```py
import base64
import subprocess
from __future__ import absolute_import, print_function
from pprint import pprint
import unittest
import webbrowser
import docusign_esign as docusign
from docusign_esign import AuthenticationApi, TemplatesApi,Envel... | 2019/08/14 | [
"https://Stackoverflow.com/questions/57502112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11929301/"
] | As the code is generated after the page rendering, you should use a delegated event handler:
```
$('body').on('click','.fc-day-grid-event', function() {
//...
});
``` | ```
<a onclick="doStuff(this)">Click Me</a>
``` |
57,502,112 | I am getting an attribute error while running the code given below:
```py
import base64
import subprocess
from __future__ import absolute_import, print_function
from pprint import pprint
import unittest
import webbrowser
import docusign_esign as docusign
from docusign_esign import AuthenticationApi, TemplatesApi,Envel... | 2019/08/14 | [
"https://Stackoverflow.com/questions/57502112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11929301/"
] | The original code is missing apostrophes after the class name and after the 'click'.
This should work:
`> $('.fc-day-grid-event').on('click', function() {
...//
});`
However you might consider to check, if there are other dom elements with that class. An ID is much safer. A workaround could be to use multiple classe... | ```
<a onclick="doStuff(this)">Click Me</a>
``` |
57,502,112 | I am getting an attribute error while running the code given below:
```py
import base64
import subprocess
from __future__ import absolute_import, print_function
from pprint import pprint
import unittest
import webbrowser
import docusign_esign as docusign
from docusign_esign import AuthenticationApi, TemplatesApi,Envel... | 2019/08/14 | [
"https://Stackoverflow.com/questions/57502112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11929301/"
] | >
> this html code was built automatically by jquery so I can't add id or "onlick" event on this tag
>
>
>
If you can't control when that happens, you can still use event delegation to get involved in the click event:
```
$(document).on('click', '.fc-day-grid-event', function() {
...//
});
```
That works even i... | As the code is generated after the page rendering, you should use a delegated event handler:
```
$('body').on('click','.fc-day-grid-event', function() {
//...
});
``` |
57,502,112 | I am getting an attribute error while running the code given below:
```py
import base64
import subprocess
from __future__ import absolute_import, print_function
from pprint import pprint
import unittest
import webbrowser
import docusign_esign as docusign
from docusign_esign import AuthenticationApi, TemplatesApi,Envel... | 2019/08/14 | [
"https://Stackoverflow.com/questions/57502112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11929301/"
] | >
> this html code was built automatically by jquery so I can't add id or "onlick" event on this tag
>
>
>
If you can't control when that happens, you can still use event delegation to get involved in the click event:
```
$(document).on('click', '.fc-day-grid-event', function() {
...//
});
```
That works even i... | The original code is missing apostrophes after the class name and after the 'click'.
This should work:
`> $('.fc-day-grid-event').on('click', function() {
...//
});`
However you might consider to check, if there are other dom elements with that class. An ID is much safer. A workaround could be to use multiple classe... |
64,525,357 | Hello i'm new to python.
i'm working with lists in python and i want to Convert a `list` named **graph** to `dictionnary` **graph** in `PYTHON`.
my have `list` :
```js
graph = [
['01 Mai',
[
['Musset', 5],
['Place 11 Decembre 1960', 4],
["Sidi M'hamed", 3],
['El Hamma (haut... | 2020/10/25 | [
"https://Stackoverflow.com/questions/64525357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11818297/"
] | A simple dict comprehension would do:
```py
as_dict = {k: dict(v) for k,v in graph}
```
[Playground](https://www.online-python.com/njzoZagLfc) | An easy solution would be:
```
for item in graph:
d[item[0]] = {record[0]: record[1] for record in item[1]}
``` |
64,525,357 | Hello i'm new to python.
i'm working with lists in python and i want to Convert a `list` named **graph** to `dictionnary` **graph** in `PYTHON`.
my have `list` :
```js
graph = [
['01 Mai',
[
['Musset', 5],
['Place 11 Decembre 1960', 4],
["Sidi M'hamed", 3],
['El Hamma (haut... | 2020/10/25 | [
"https://Stackoverflow.com/questions/64525357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11818297/"
] | A simple dict comprehension would do:
```py
as_dict = {k: dict(v) for k,v in graph}
```
[Playground](https://www.online-python.com/njzoZagLfc) | You can use recursion to handle input of unknown depth:
```
graph = [['01 Mai', [['Musset', 5], ['Place 11 Decembre 1960', 4], ["Sidi M'hamed", 3], ['El Hamma (haut)', 6]]], ['Musset', [['Place 11 Decembre 1960', 4], ["Sidi M'hamed", 3], ['El Hamma (haut)', 6], ["Jardin d'Essai (haut)", 10]]]]
def to_dict(d):
return... |
64,525,357 | Hello i'm new to python.
i'm working with lists in python and i want to Convert a `list` named **graph** to `dictionnary` **graph** in `PYTHON`.
my have `list` :
```js
graph = [
['01 Mai',
[
['Musset', 5],
['Place 11 Decembre 1960', 4],
["Sidi M'hamed", 3],
['El Hamma (haut... | 2020/10/25 | [
"https://Stackoverflow.com/questions/64525357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11818297/"
] | You can use recursion to handle input of unknown depth:
```
graph = [['01 Mai', [['Musset', 5], ['Place 11 Decembre 1960', 4], ["Sidi M'hamed", 3], ['El Hamma (haut)', 6]]], ['Musset', [['Place 11 Decembre 1960', 4], ["Sidi M'hamed", 3], ['El Hamma (haut)', 6], ["Jardin d'Essai (haut)", 10]]]]
def to_dict(d):
return... | An easy solution would be:
```
for item in graph:
d[item[0]] = {record[0]: record[1] for record in item[1]}
``` |
57,532,371 | I have the following 8 (possibly non-unique) lists in python:
```
>>> a = [{9: {10:11}}, {}, {}]
>>> b = [{1:2}, {3:4}, {5:6}]
>>> c = [{}, {}, {}]
>>> d = [{1:2}, {3:4}, {5:6}]
>>> w = [{}, {}, {}]
>>> x = [{1:2}, {3:4}, {5:6}]
>>> y = [{}, {}, {}]
>>> z = [{1:2}, {3:4}, {5:6}]
```
I want to check if any combinatio... | 2019/08/17 | [
"https://Stackoverflow.com/questions/57532371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1742777/"
] | You can abuse [`frozenset`](https://docs.python.org/3/library/stdtypes.html#frozenset) by turning each list of dictionaries to a frozenset of frozensets, with the internal frozensets being each dictionary's items:
```
def freeze(li):
return frozenset(frozenset(d.items()) for d in li)
a = freeze(a)
b = freeze(b)
c... | @DeepSpace's answer works only if each sub-dict in a list is unique, since `[a, b, c, d]` should not be considered the same as `[a, a, b, c, d]`, but with @DeepSpace's use of the `set` constructor, they will be treated as the same.
To correctly account for possible duplicating items in the list, you can use `collectio... |
57,532,371 | I have the following 8 (possibly non-unique) lists in python:
```
>>> a = [{9: {10:11}}, {}, {}]
>>> b = [{1:2}, {3:4}, {5:6}]
>>> c = [{}, {}, {}]
>>> d = [{1:2}, {3:4}, {5:6}]
>>> w = [{}, {}, {}]
>>> x = [{1:2}, {3:4}, {5:6}]
>>> y = [{}, {}, {}]
>>> z = [{1:2}, {3:4}, {5:6}]
```
I want to check if any combinatio... | 2019/08/17 | [
"https://Stackoverflow.com/questions/57532371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1742777/"
] | You can abuse [`frozenset`](https://docs.python.org/3/library/stdtypes.html#frozenset) by turning each list of dictionaries to a frozenset of frozensets, with the internal frozensets being each dictionary's items:
```
def freeze(li):
return frozenset(frozenset(d.items()) for d in li)
a = freeze(a)
b = freeze(b)
c... | You could generate hashable objects such as:
```py
def fset(item):
l = []
for k, v in item.items():
if isinstance(v, dict):
l.append((k, fset(v)))
else:
l.append((k, v))
return frozenset(l)
a = [{9: {10:11}}, {}, {}]
fa = [fset(i) for i in a]
>>> fa
[frozenset({(... |
16,127,493 | This error broke my python-mysql installation on Mac 10.7.5. Here are the steps
1. The installed python is 2.7.1, mysql is 64 bit for 5.6.11.
2. The being installed python-mysql is 1.2.4, also tried 1.2.3
3. Configurations for the installation
```
1) sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
2) Edit... | 2013/04/21 | [
"https://Stackoverflow.com/questions/16127493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/351637/"
] | Try to Remove `cflags -Wno-null-conversion -Wno-unused-private-field` in
```
/usr/local/mysql/bin/mysql_config.
```
like:
```
cflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
``` | Wow, I've been spending a couple of hours on thistrying to 'pip install MySQL-python'. I have been re-installing Xcode 4.6.3, the Xcode command line tools seperatly (on Mac OS X 10.7.5), and installing Kenneth Reitz' stuff (<https://github.com/kennethreitz/osx-gcc-installer>) to no avail while I was ...
Altering the c... |
57,578,345 | Suppose i have the coefficients of a polynomial.How to write it in the usual form we write in pen and paper?E.g. if i have coefficients=1,-2,5 and the polynomial is a quadratic one then the program should print `x**2-2*x+5.
1*x**2-2*x**1+5*x**0` will also do.It is preferable that the program is written such that it wor... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57578345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10444871/"
] | Here is a program that would work, without using the external packages. I have defined a Poly class and it has two methods: 1) evaluation 2) print the polynomial.
```
class Poly():
def __init__(self, coeff):
self.coeff = coeff
self.N = len(coeff)
def evaluate(self, x):
res = 0.0
... | For this task, you have to use python's symbolic module ([sympy](https://www.sympy.org/en/index.html)) since you specifically want your output to be a polynomial representation. The following code should do the job.
```
import sympy
from sympy import poly
x = sympy.Symbol('x') # Create a symbol x
coefficients = [1,... |
8,337,686 | Here is my `.bash_profile`
```
PYTHONPATH=".:/home/miki725/django/django:$PYTHONPATH"
export PYTHONPATH
```
So then I open python however the directory I add in `.bash_profile` is not the first one:
```
Python 2.4.3 (#1, Sep 21 2011, 20:06:00)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyrig... | 2011/12/01 | [
"https://Stackoverflow.com/questions/8337686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485844/"
] | Your best bet is to modify `sys.path` at runtime. In a shared hosting enviroment it's common to do this in your .wsgi file. You could do something like this:
```
import sys
sys.path.insert(0, '/home/miki725/django/django')
```
If you add `export PYTHONSTARTUP=/home/miki725/.pythonrc` to your `.bash_profile`, you can... | I'd say that your `PYTHONPATH` is being modified when the [site](http://docs.python.org/release/2.4.3/lib/module-site.html) module is imported. Please have a look at the [user](http://docs.python.org/release/2.4.3/lib/module-user.html) module to provide user-specific configuration (basically just prepend the directorie... |
8,337,686 | Here is my `.bash_profile`
```
PYTHONPATH=".:/home/miki725/django/django:$PYTHONPATH"
export PYTHONPATH
```
So then I open python however the directory I add in `.bash_profile` is not the first one:
```
Python 2.4.3 (#1, Sep 21 2011, 20:06:00)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyrig... | 2011/12/01 | [
"https://Stackoverflow.com/questions/8337686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485844/"
] | Your best bet is to modify `sys.path` at runtime. In a shared hosting enviroment it's common to do this in your .wsgi file. You could do something like this:
```
import sys
sys.path.insert(0, '/home/miki725/django/django')
```
If you add `export PYTHONSTARTUP=/home/miki725/.pythonrc` to your `.bash_profile`, you can... | As an alternative approach, you could modify `sys.path` directly from the interpreter:
```
sys.path.insert(0,"/home/miki725/django/django")
``` |
8,337,686 | Here is my `.bash_profile`
```
PYTHONPATH=".:/home/miki725/django/django:$PYTHONPATH"
export PYTHONPATH
```
So then I open python however the directory I add in `.bash_profile` is not the first one:
```
Python 2.4.3 (#1, Sep 21 2011, 20:06:00)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyrig... | 2011/12/01 | [
"https://Stackoverflow.com/questions/8337686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485844/"
] | Your best bet is to modify `sys.path` at runtime. In a shared hosting enviroment it's common to do this in your .wsgi file. You could do something like this:
```
import sys
sys.path.insert(0, '/home/miki725/django/django')
```
If you add `export PYTHONSTARTUP=/home/miki725/.pythonrc` to your `.bash_profile`, you can... | As indicated by others, you modify the `sys.path` directly in Python like this:
```
sys.path.insert(0,"/home/miki725/django/django")
```
But I think that [virtualenv](http://pypi.python.org/pypi/virtualenv) is the solution you are looking for. This tool allows you to create isolated Python environments. |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | Try to run `python27 django-admin.py startproject mysite` from the command line,maybe a different (older) python.exe executes the `django-admin.py` file. If there's a program associated to the `.py` files, things mixes up, and your `path` environment variable doesn't matter.
I suggest you to use [virtualenv](http://p... | Great answers. But unfortunately it did not work for me. This is how I solved it
1. Opened `django_admin.py` as @wynston said. But the path at first line was already showing `#!C:\` correctly. So did not had to change it
2. I had to put `"..."` around `django-admin.py` address. Navigated to the project directory in `c... |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | Change the first line of django-admin.py `#!/usr/bin/env python` to for example
`#!D:\Program Files\Python\python.exe` (Where you install your python.exe,that's my directory), it works. | Great answers. But unfortunately it did not work for me. This is how I solved it
1. Opened `django_admin.py` as @wynston said. But the path at first line was already showing `#!C:\` correctly. So did not had to change it
2. I had to put `"..."` around `django-admin.py` address. Navigated to the project directory in `c... |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | Change the first line of django-admin.py `#!/usr/bin/env python` to for example
`#!D:\Program Files\Python\python.exe` (Where you install your python.exe,that's my directory), it works. | The solution is simple in Windows:
1-Go to C: \ Python34 \ Scripts
2-Right click on django-admin.py
3-Select open with
4-Select default program
5-Select Laucher Python for Windows (Console)
6- Run the command in CMD Windows `python django-admin.py startproject mysite` |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | I ran into the same problem.
Never having worked with Django before but having worked with Python 2.7 a fair bit, all on a windows 7 platform. I downloaded the latest version of Django and unpacked it on my desktop.
After mucking around a bit managed to get it to install itself. I found could not just follow the tut... | The solution is simple in Windows:
1-Go to C: \ Python34 \ Scripts
2-Right click on django-admin.py
3-Select open with
4-Select default program
5-Select Laucher Python for Windows (Console)
6- Run the command in CMD Windows `python django-admin.py startproject mysite` |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | I ran into the same problem.
Never having worked with Django before but having worked with Python 2.7 a fair bit, all on a windows 7 platform. I downloaded the latest version of Django and unpacked it on my desktop.
After mucking around a bit managed to get it to install itself. I found could not just follow the tut... | Use `python django-admin.py startproject mysite`. That worked for me some time ago when I had the same issue. |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | Change the first line of django-admin.py `#!/usr/bin/env python` to for example
`#!D:\Program Files\Python\python.exe` (Where you install your python.exe,that's my directory), it works. | Use `python django-admin.py startproject mysite`. That worked for me some time ago when I had the same issue. |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | I ran into the same problem.
Never having worked with Django before but having worked with Python 2.7 a fair bit, all on a windows 7 platform. I downloaded the latest version of Django and unpacked it on my desktop.
After mucking around a bit managed to get it to install itself. I found could not just follow the tut... | Great answers. But unfortunately it did not work for me. This is how I solved it
1. Opened `django_admin.py` as @wynston said. But the path at first line was already showing `#!C:\` correctly. So did not had to change it
2. I had to put `"..."` around `django-admin.py` address. Navigated to the project directory in `c... |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | I ran into the same problem.
Never having worked with Django before but having worked with Python 2.7 a fair bit, all on a windows 7 platform. I downloaded the latest version of Django and unpacked it on my desktop.
After mucking around a bit managed to get it to install itself. I found could not just follow the tut... | Change the first line of django-admin.py `#!/usr/bin/env python` to for example
`#!D:\Program Files\Python\python.exe` (Where you install your python.exe,that's my directory), it works. |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | Try to run `python27 django-admin.py startproject mysite` from the command line,maybe a different (older) python.exe executes the `django-admin.py` file. If there's a program associated to the `.py` files, things mixes up, and your `path` environment variable doesn't matter.
I suggest you to use [virtualenv](http://p... | The solution is simple in Windows:
1-Go to C: \ Python34 \ Scripts
2-Right click on django-admin.py
3-Select open with
4-Select default program
5-Select Laucher Python for Windows (Console)
6- Run the command in CMD Windows `python django-admin.py startproject mysite` |
9,252,970 | It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.
I already set the environmental variables, and set the file association to my `python27.exe`
When I run `django-admin.py` startproject mysite from the DOS command prompt, it executes, but it's showing me all the... | 2012/02/12 | [
"https://Stackoverflow.com/questions/9252970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1159856/"
] | Try to run `python27 django-admin.py startproject mysite` from the command line,maybe a different (older) python.exe executes the `django-admin.py` file. If there's a program associated to the `.py` files, things mixes up, and your `path` environment variable doesn't matter.
I suggest you to use [virtualenv](http://p... | Use `python django-admin.py startproject mysite`. That worked for me some time ago when I had the same issue. |
30,029,625 | I can't install [Rodeo](https://github.com/yhat/rodeo) with pip, on Ubuntu 14.04.2 LTS 64 bit (installed on a Virtual Box)
For information I'm a Python and Ubuntu beginner and I installed pip by following this [tutorial](http://www.liquidweb.com/kb/how-to-install-pip-on-ubuntu-14-04-lts/)
`pip -V`
`pip 6.1.1 from /u... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30029625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2236787/"
] | You will need to install python-dev/libzmq-dev for the installation to succeed. The problem is that while you can install most Python libraries using pip, some of them depend on C or C++ libraries. These libraries cannot be downloaded using PIP, so they need to be installed manually.
As PIP will only install Python li... | As of Rodeo v2.0, it is no longer installable via pip. On Ubuntu, you can install it using the Rodeo apt repo, commands are below:
```
#### add the yhat public key and the repo
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 33D40BC6
sudo add-apt-repository -u "deb http://rodeo-deb.yhat.com/ rodeo main"
... |
21,592,965 | I am writing a small script for a Tic Tac Toe game in python. I store the Tic Tac Toe grid in a list like this (example of a empty grid): `[[' ', ' ', ' ',], [' ', ' ', ' ',], [' ', ' ', ' ',]]`. These are the following possible string for the list:
* `' '` no player has marked this field
* `'X'` player X
* `'O'` play... | 2014/02/06 | [
"https://Stackoverflow.com/questions/21592965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2911408/"
] | ```
x_lst = [' '] * size
lst = []
for y in range(size):
lst.append(x_lst)
```
All elements of `lst` are the same list object. If you want equal but independent lists, create a new list each time:
```
lst = []
for y in range(size):
lst.append([' '] * size)
``` | Your board consists of three references to a single row. You need to make three separate rows, like so:
```
lst = [[' ']*3 for _ in range(3)]
``` |
59,726,776 | My question :
I was working on my computer vision project. I use opencv(4.1.2) and python to implement it.
I need a faster way to pass the reading frame into image processing on my Computer(Ubuntu 18.04 8 cores i7 3.00GHz Memory 32GB). the `cv2.VideoCapture.read()` read frame (frame size : 720x1280) will take about ... | 2020/01/14 | [
"https://Stackoverflow.com/questions/59726776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9383559/"
] | This comes a bit late, but I was wondering this with my Logitech C920 HD Pro USB-camera on Ubuntu 20.04 and OpenCV. I tried to command the capture session to run Full HD @ 30 FPS but the FPS was fluctuating between 4-5 FPS.
The capture format for my camera defaulted as "YUYV 4:2:2". No matter how I tried to alter the ... | Long.
I checked using the following settings and somehow if you increase the frame size opencv will reduce the total fps. Maybe this is a bug.
1920x1080 : FPS: 5.0, Width: 1920.0, Height: 1080.0 , delay = 150ms
<https://imgur.com/Vab61cF>
1280x720 : FPS: 10.0, Width: 1280.0, Height: 720.0, delay = 60ms
<https://... |
59,726,776 | My question :
I was working on my computer vision project. I use opencv(4.1.2) and python to implement it.
I need a faster way to pass the reading frame into image processing on my Computer(Ubuntu 18.04 8 cores i7 3.00GHz Memory 32GB). the `cv2.VideoCapture.read()` read frame (frame size : 720x1280) will take about ... | 2020/01/14 | [
"https://Stackoverflow.com/questions/59726776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9383559/"
] | **This is the best solution ever**
From This
```
capture = cv2.VideoCapture(0)
```
to
```
capture = cv2.VideoCapture(0, cv2.CAP_DSHOW)
```
I searched for much time but not found the best solution but this solution works faster open cv2 video capture try now hope useful for you.
just use `cv2.VideoCapture(0, cv2.... | Long.
I checked using the following settings and somehow if you increase the frame size opencv will reduce the total fps. Maybe this is a bug.
1920x1080 : FPS: 5.0, Width: 1920.0, Height: 1080.0 , delay = 150ms
<https://imgur.com/Vab61cF>
1280x720 : FPS: 10.0, Width: 1280.0, Height: 720.0, delay = 60ms
<https://... |
59,726,776 | My question :
I was working on my computer vision project. I use opencv(4.1.2) and python to implement it.
I need a faster way to pass the reading frame into image processing on my Computer(Ubuntu 18.04 8 cores i7 3.00GHz Memory 32GB). the `cv2.VideoCapture.read()` read frame (frame size : 720x1280) will take about ... | 2020/01/14 | [
"https://Stackoverflow.com/questions/59726776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9383559/"
] | In my case, I have set camera like this (in c++ code):
```cpp
// cam is cv::VideoCapture object
cam.set(cv::CAP_PROP_BUFFERSIZE, 1);
cam.set(cv::CAP_PROP_FPS, 20); // set fps before set fourcc
cam.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));
```
`CAP_PROP_BUFFERSIZE` doesn't matter, but `CA... | Long.
I checked using the following settings and somehow if you increase the frame size opencv will reduce the total fps. Maybe this is a bug.
1920x1080 : FPS: 5.0, Width: 1920.0, Height: 1080.0 , delay = 150ms
<https://imgur.com/Vab61cF>
1280x720 : FPS: 10.0, Width: 1280.0, Height: 720.0, delay = 60ms
<https://... |
59,726,776 | My question :
I was working on my computer vision project. I use opencv(4.1.2) and python to implement it.
I need a faster way to pass the reading frame into image processing on my Computer(Ubuntu 18.04 8 cores i7 3.00GHz Memory 32GB). the `cv2.VideoCapture.read()` read frame (frame size : 720x1280) will take about ... | 2020/01/14 | [
"https://Stackoverflow.com/questions/59726776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9383559/"
] | This comes a bit late, but I was wondering this with my Logitech C920 HD Pro USB-camera on Ubuntu 20.04 and OpenCV. I tried to command the capture session to run Full HD @ 30 FPS but the FPS was fluctuating between 4-5 FPS.
The capture format for my camera defaulted as "YUYV 4:2:2". No matter how I tried to alter the ... | **This is the best solution ever**
From This
```
capture = cv2.VideoCapture(0)
```
to
```
capture = cv2.VideoCapture(0, cv2.CAP_DSHOW)
```
I searched for much time but not found the best solution but this solution works faster open cv2 video capture try now hope useful for you.
just use `cv2.VideoCapture(0, cv2.... |
59,726,776 | My question :
I was working on my computer vision project. I use opencv(4.1.2) and python to implement it.
I need a faster way to pass the reading frame into image processing on my Computer(Ubuntu 18.04 8 cores i7 3.00GHz Memory 32GB). the `cv2.VideoCapture.read()` read frame (frame size : 720x1280) will take about ... | 2020/01/14 | [
"https://Stackoverflow.com/questions/59726776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9383559/"
] | This comes a bit late, but I was wondering this with my Logitech C920 HD Pro USB-camera on Ubuntu 20.04 and OpenCV. I tried to command the capture session to run Full HD @ 30 FPS but the FPS was fluctuating between 4-5 FPS.
The capture format for my camera defaulted as "YUYV 4:2:2". No matter how I tried to alter the ... | In my case, I have set camera like this (in c++ code):
```cpp
// cam is cv::VideoCapture object
cam.set(cv::CAP_PROP_BUFFERSIZE, 1);
cam.set(cv::CAP_PROP_FPS, 20); // set fps before set fourcc
cam.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));
```
`CAP_PROP_BUFFERSIZE` doesn't matter, but `CA... |
1,475,193 | My class contains a socket that connects to a server. Some of the methods of the class can throw an exception. The script I'm running contains an outer loop that catches the exception, logs an error, and creates a new class instance that tries to reconnect to the server.
Problem is that the server only handles one con... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1475193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67022/"
] | This is an artifact of garbage collection. Even though the object is *out of scope*, it is not necessarily *collected* and therefore *destroyed* until a garbage collection run occurs -- this is not like C++ where a destructor is called as soon as an object loses scope.
You can probably work around this particular issu... | Ok, here's the final version. Explicitly close the socket objects when something gets borked.
```
import socket
class MyException(Exception):
pass
class MyClient(object):
def __init__(self, port):
self.sock = socket.create_connection(('localhost', port))
self.sockfile = self.sock.makefile()
... |
1,475,193 | My class contains a socket that connects to a server. Some of the methods of the class can throw an exception. The script I'm running contains an outer loop that catches the exception, logs an error, and creates a new class instance that tries to reconnect to the server.
Problem is that the server only handles one con... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1475193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67022/"
] | This is an artifact of garbage collection. Even though the object is *out of scope*, it is not necessarily *collected* and therefore *destroyed* until a garbage collection run occurs -- this is not like C++ where a destructor is called as soon as an object loses scope.
You can probably work around this particular issu... | The garbage collector can be flagged to clean up by setting the relevant object to None. |
1,475,193 | My class contains a socket that connects to a server. Some of the methods of the class can throw an exception. The script I'm running contains an outer loop that catches the exception, logs an error, and creates a new class instance that tries to reconnect to the server.
Problem is that the server only handles one con... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1475193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67022/"
] | This is an artifact of garbage collection. Even though the object is *out of scope*, it is not necessarily *collected* and therefore *destroyed* until a garbage collection run occurs -- this is not like C++ where a destructor is called as soon as an object loses scope.
You can probably work around this particular issu... | Can you really handle the Exception in connect()?
I think you should provide a MyClient.close() method, and write connect() like this:
```
def connect():
try:
c = MyClient(9989)
print c.do_stuff()
finally:
c.close()
```
This is in complete analogy with file-like objects (and the with... |
1,475,193 | My class contains a socket that connects to a server. Some of the methods of the class can throw an exception. The script I'm running contains an outer loop that catches the exception, logs an error, and creates a new class instance that tries to reconnect to the server.
Problem is that the server only handles one con... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1475193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67022/"
] | Can you really handle the Exception in connect()?
I think you should provide a MyClient.close() method, and write connect() like this:
```
def connect():
try:
c = MyClient(9989)
print c.do_stuff()
finally:
c.close()
```
This is in complete analogy with file-like objects (and the with... | Ok, here's the final version. Explicitly close the socket objects when something gets borked.
```
import socket
class MyException(Exception):
pass
class MyClient(object):
def __init__(self, port):
self.sock = socket.create_connection(('localhost', port))
self.sockfile = self.sock.makefile()
... |
1,475,193 | My class contains a socket that connects to a server. Some of the methods of the class can throw an exception. The script I'm running contains an outer loop that catches the exception, logs an error, and creates a new class instance that tries to reconnect to the server.
Problem is that the server only handles one con... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1475193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67022/"
] | Can you really handle the Exception in connect()?
I think you should provide a MyClient.close() method, and write connect() like this:
```
def connect():
try:
c = MyClient(9989)
print c.do_stuff()
finally:
c.close()
```
This is in complete analogy with file-like objects (and the with... | The garbage collector can be flagged to clean up by setting the relevant object to None. |
45,692,749 | Hello Python community I am angular and node.js developer and I want to try Python as backend of my server because I am new to python I want to ask you how to target the dist folder that contains all HTML and CSS and js files from the angular 4 apps in flask python server
Because my app is SPA application I have set r... | 2017/08/15 | [
"https://Stackoverflow.com/questions/45692749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6600549/"
] | Since I had this same problem, I hope this answer will help someone looking for it again.
1. First create your angular application and build it. (You will get all the required js files and index.html file inside the 'dist' folder.
2. Create your python + flask web app with required end points.
```
from flask import F... | I don't think that it's possible to access Angular 'dist' directory via a REST API. Any routing should be done on the client-side with Angular, and Flask should handle your end-points.
In terms of building your REST API, I'd recommend something like this:
```
from flask import Flask, jsonify
app = Flask(__name__)
... |
35,253,338 | I am able to import the pandas package within the spyder ide; however, if I attempt to open a new juypter notebook, the import fails.
I use the Anaconda package distribution on MAC OS X.
Here is what I do:
```
In [1]: import pandas
```
and this is the response I get:
```
---------------------------------------... | 2016/02/07 | [
"https://Stackoverflow.com/questions/35253338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902319/"
] | You have more than one Python 2 engines installed. One in your main OS platform, another one inside Anaconda's virtual environment. You need to install Panda on the latter.
Run in your Bash prompt:
```
which python
```
Then run the following in Jupyter/IPython and compare the result with the output you got from th... | I had the same issue on Mac OS X with Anaconda (Python 2). I tried importing the pandas package in python repl, and got this error:
```
ValueError: unknown locale: UTF-8
```
Therefore, I've added the following lines to my ~/.bash\_profile:
```
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
```
And this has fix... |
35,253,338 | I am able to import the pandas package within the spyder ide; however, if I attempt to open a new juypter notebook, the import fails.
I use the Anaconda package distribution on MAC OS X.
Here is what I do:
```
In [1]: import pandas
```
and this is the response I get:
```
---------------------------------------... | 2016/02/07 | [
"https://Stackoverflow.com/questions/35253338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902319/"
] | You have more than one Python 2 engines installed. One in your main OS platform, another one inside Anaconda's virtual environment. You need to install Panda on the latter.
Run in your Bash prompt:
```
which python
```
Then run the following in Jupyter/IPython and compare the result with the output you got from th... | One thing that you can do it is install the libraries straight in Jupyter, you can try, in the cell:
```
!pip install pandas
```
or
```
!pip3 install pandas
``` |
35,253,338 | I am able to import the pandas package within the spyder ide; however, if I attempt to open a new juypter notebook, the import fails.
I use the Anaconda package distribution on MAC OS X.
Here is what I do:
```
In [1]: import pandas
```
and this is the response I get:
```
---------------------------------------... | 2016/02/07 | [
"https://Stackoverflow.com/questions/35253338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902319/"
] | I had the same issue on Mac OS X with Anaconda (Python 2). I tried importing the pandas package in python repl, and got this error:
```
ValueError: unknown locale: UTF-8
```
Therefore, I've added the following lines to my ~/.bash\_profile:
```
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
```
And this has fix... | One thing that you can do it is install the libraries straight in Jupyter, you can try, in the cell:
```
!pip install pandas
```
or
```
!pip3 install pandas
``` |
67,558,323 | Here's the thing, I'm building a streamlit app to get the cohorts data. Just like explained here: <https://towardsdatascience.com/a-step-by-step-introduction-to-cohort-analysis-in-python-a2cbbd8460ea>. So, basically I'm now at the point where I have a dataframe with the cohort date (cohort), the number of customers tha... | 2021/05/16 | [
"https://Stackoverflow.com/questions/67558323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15317245/"
] | The function `enumerate` returns a tuple which is causing the `TypeError`. You can just keep a placeholder variable to separate the tuple into i and another placeholder variable, like this:
```
print(*[min(abs(i - j) for j in b) for i,_ in enumerate(a)])
```
Or alternatively, not use `enumerate` at all.
```
print(*... | the enumerate function is used to get the index and the data of the list at the same time.
so enumerate gives,
for data,index in enumerate(a) |
54,642,243 | I'm trying to make a program in python for a data networking class to read in a file that contains 8 characters such as 00111001 and put it in a packet to then be converted to ASCII. I want to iterate through the packet and if it's a 1 then add the number in the conversation\_list =[128,64,32,16,8,4,2,1] according to t... | 2019/02/12 | [
"https://Stackoverflow.com/questions/54642243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7092778/"
] | ```
int[][] winner = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}};
```
This is all possible cases when there is a winner. The first 3 is horizontal, the next 3 is vertical, the last 2 is diagonal, where the numbers are defined like this, indicated in the previous code:
``... | I am assuming you are asking about the for each loop:
```
for (int[] columnWinner : winner) {
```
The loop is called a for each loop that creates a variable and gives it a value for every iteration in the loop.
In this case, the loop creates an array of length 3 named columnWinner for each possible row, column, an... |
54,642,243 | I'm trying to make a program in python for a data networking class to read in a file that contains 8 characters such as 00111001 and put it in a packet to then be converted to ASCII. I want to iterate through the packet and if it's a 1 then add the number in the conversation\_list =[128,64,32,16,8,4,2,1] according to t... | 2019/02/12 | [
"https://Stackoverflow.com/questions/54642243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7092778/"
] | ```
int[][] winner = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}};
```
This is all possible cases when there is a winner. The first 3 is horizontal, the next 3 is vertical, the last 2 is diagonal, where the numbers are defined like this, indicated in the previous code:
``... | The 3 x 3 board is represented (rather strangely) by a one-dimensional array. All winning positions were determined by hand and listed in the `winner` array, in triples because it takes 3 markers to occupy a winnng position in tic-tac-toe.
The loop you indicate is checked each of those winning positions in turn.
For ... |
41,042,599 | I read that it is one of the advantages of xgboost, that you can train on an existing model. Say I trained my model for 100 iterations, and want to restart from there to finish another 100 iterations, instead of redoing everything from the scratch..
I found this in xgboost demo examples, from here <https://github.com/... | 2016/12/08 | [
"https://Stackoverflow.com/questions/41042599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544102/"
] | figured it out, from this issue in xgboost repo <https://github.com/dmlc/xgboost/issues/235>
>
> Yes, this is something we overlooked when designing the interface, you should be able to set\_margin with flattened array.
>
>
>
`set_base_margin` expects a 1d array, so you just need to flatten the margined predictio... | Things have changed now....
```
bst = xgb.train(param, dtrain, 1, watchlist , xgb_model=bst )
``` |
21,613,906 | I've got a python script that writes some data to a pipe when called:
```
def send_to_pipe(s):
send = '/var/tmp/mypipe.pipe'
sp = open(send, 'w')
sp.write(json.dumps(s))
sp.close()
if __name__ == "__main__":
name = sys.argv[1]
command = sys.argv[2]
s = {"name":name, "command":command}
... | 2014/02/06 | [
"https://Stackoverflow.com/questions/21613906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3272993/"
] | I think I don't understand exactly what you want.
* Option A:
\*\* Signal R. Server: Hosted as a Windows Service
\*\* Signal R. Client: ASP.NET MVC Application.
* Option B
\*\* Signal R. Server: ASP.NET MVC Application.
\*\* Signal R. Client: Windows Service
If what you need is Option A. You might want to take... | This tutorial may help, and it also includes some sample code:
<http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-getting-started-with-signalr-20> |
21,613,906 | I've got a python script that writes some data to a pipe when called:
```
def send_to_pipe(s):
send = '/var/tmp/mypipe.pipe'
sp = open(send, 'w')
sp.write(json.dumps(s))
sp.close()
if __name__ == "__main__":
name = sys.argv[1]
command = sys.argv[2]
s = {"name":name, "command":command}
... | 2014/02/06 | [
"https://Stackoverflow.com/questions/21613906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3272993/"
] | Lets say you have the following code.
```
var _connection = new HubConnection("http://localhost:61194/signalr");
var _myHub = _connection.CreateHubProxy("MyHub");
```
You can create as many proxies that you have in the server.
Then you can invoke the server method in following ways.
```
_my... | This tutorial may help, and it also includes some sample code:
<http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-getting-started-with-signalr-20> |
21,613,906 | I've got a python script that writes some data to a pipe when called:
```
def send_to_pipe(s):
send = '/var/tmp/mypipe.pipe'
sp = open(send, 'w')
sp.write(json.dumps(s))
sp.close()
if __name__ == "__main__":
name = sys.argv[1]
command = sys.argv[2]
s = {"name":name, "command":command}
... | 2014/02/06 | [
"https://Stackoverflow.com/questions/21613906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3272993/"
] | This solves the problem
On the client (Windows Service):
```
protected override async void OnStart(string[] args)
{
eventLog1.WriteEntry("In OnStart");
try
{
var hubConnection = new HubConnection("http://www.savitassa.com/signalr", useDefaultUrl: false);
... | This tutorial may help, and it also includes some sample code:
<http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-getting-started-with-signalr-20> |
21,613,906 | I've got a python script that writes some data to a pipe when called:
```
def send_to_pipe(s):
send = '/var/tmp/mypipe.pipe'
sp = open(send, 'w')
sp.write(json.dumps(s))
sp.close()
if __name__ == "__main__":
name = sys.argv[1]
command = sys.argv[2]
s = {"name":name, "command":command}
... | 2014/02/06 | [
"https://Stackoverflow.com/questions/21613906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3272993/"
] | This solves the problem
On the client (Windows Service):
```
protected override async void OnStart(string[] args)
{
eventLog1.WriteEntry("In OnStart");
try
{
var hubConnection = new HubConnection("http://www.savitassa.com/signalr", useDefaultUrl: false);
... | I think I don't understand exactly what you want.
* Option A:
\*\* Signal R. Server: Hosted as a Windows Service
\*\* Signal R. Client: ASP.NET MVC Application.
* Option B
\*\* Signal R. Server: ASP.NET MVC Application.
\*\* Signal R. Client: Windows Service
If what you need is Option A. You might want to take... |
21,613,906 | I've got a python script that writes some data to a pipe when called:
```
def send_to_pipe(s):
send = '/var/tmp/mypipe.pipe'
sp = open(send, 'w')
sp.write(json.dumps(s))
sp.close()
if __name__ == "__main__":
name = sys.argv[1]
command = sys.argv[2]
s = {"name":name, "command":command}
... | 2014/02/06 | [
"https://Stackoverflow.com/questions/21613906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3272993/"
] | This solves the problem
On the client (Windows Service):
```
protected override async void OnStart(string[] args)
{
eventLog1.WriteEntry("In OnStart");
try
{
var hubConnection = new HubConnection("http://www.savitassa.com/signalr", useDefaultUrl: false);
... | Lets say you have the following code.
```
var _connection = new HubConnection("http://localhost:61194/signalr");
var _myHub = _connection.CreateHubProxy("MyHub");
```
You can create as many proxies that you have in the server.
Then you can invoke the server method in following ways.
```
_my... |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | Please follow the steps mentioned in the [link](https://www.nextofwindows.com/allow-server-running-inside-wsl-to-be-accessible-outside-windows-10-host) shared by @erazerbrecht and run your HTTP server by providing your ip address (instead of using localhost) and port number.
example:
```
Serving HTTP on 192.168.1.178... | I followed [the answer by @toran-sahu](https://stackoverflow.com/a/51998308/8917310) about adding an inbound rule to Windows Defender Firewall but recently (after adding a 2nd wsl2 instance) it stopped working again. I came across [this issue thread](https://github.com/microsoft/WSL/issues/4204) and running the followi... |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | Please follow the steps mentioned in the [link](https://www.nextofwindows.com/allow-server-running-inside-wsl-to-be-accessible-outside-windows-10-host) shared by @erazerbrecht and run your HTTP server by providing your ip address (instead of using localhost) and port number.
example:
```
Serving HTTP on 192.168.1.178... | Similar to @countach 's answer:
If using Ubuntu type `ip address` in the WSL terminal. Look for the entry that says `#: eth0 ...` where `#` is some small number. There is an ip address there. Use that. |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | In your VM, execute ifconfig
You will see your IP in the first section (eth0:) inet x.x.x.x
This x.x.x.x is the IP you have to put in your browser. | **Avoid using firewall rules used in some answers on the web, I saw some of them create some kind of allow-all firewall rule (allow any terrafic from any ip and any port), this can cause security problems**
Simply use this single line from [this answer](https://stackoverflow.com/a/70566842/11190169) which worked perfe... |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | None of the existing answers work for me, as WSL2 is running in its own VM and has its own network adapter. You need some sort of bridge or port forwarding for non-localhost requests to work (i.e. from another host on the same network).
I found a script in <https://github.com/microsoft/WSL/issues/4150> that worked to ... | >
> it means that I can't connect to this web server from another pc in my network. Is it possible to getting an access to WSL from outside?
>
>
>
It should be noted, among all the answers here, that this question was originally for WSL1 (given when it was asked) and was [self-answered](https://stackoverflow.com/a... |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | In your VM, execute ifconfig
You will see your IP in the first section (eth0:) inet x.x.x.x
This x.x.x.x is the IP you have to put in your browser. | Similar to @countach 's answer:
If using Ubuntu type `ip address` in the WSL terminal. Look for the entry that says `#: eth0 ...` where `#` is some small number. There is an ip address there. Use that. |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | >
> it means that I can't connect to this web server from another pc in my network. Is it possible to getting an access to WSL from outside?
>
>
>
It should be noted, among all the answers here, that this question was originally for WSL1 (given when it was asked) and was [self-answered](https://stackoverflow.com/a... | I've tested on **Update for Microsoft Windows(KB4532132)** with reinstalled WSL and it works as expected. Seems the issue was related to old windows version or old WSL version. |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | Please follow the steps mentioned in the [link](https://www.nextofwindows.com/allow-server-running-inside-wsl-to-be-accessible-outside-windows-10-host) shared by @erazerbrecht and run your HTTP server by providing your ip address (instead of using localhost) and port number.
example:
```
Serving HTTP on 192.168.1.178... | **Avoid using firewall rules used in some answers on the web, I saw some of them create some kind of allow-all firewall rule (allow any terrafic from any ip and any port), this can cause security problems**
Simply use this single line from [this answer](https://stackoverflow.com/a/70566842/11190169) which worked perfe... |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | None of the existing answers work for me, as WSL2 is running in its own VM and has its own network adapter. You need some sort of bridge or port forwarding for non-localhost requests to work (i.e. from another host on the same network).
I found a script in <https://github.com/microsoft/WSL/issues/4150> that worked to ... | I followed [the answer by @toran-sahu](https://stackoverflow.com/a/51998308/8917310) about adding an inbound rule to Windows Defender Firewall but recently (after adding a 2nd wsl2 instance) it stopped working again. I came across [this issue thread](https://github.com/microsoft/WSL/issues/4204) and running the followi... |
49,835,559 | After installing Ubuntu as WSL(Windows Subsystem for Linux) I've run:
```
root@teclast:~# python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...
```
and try to access to this web server from my windows machine `http://0.0.0.0:8000` or `http://192.168.1.178:8000` but no success, web server available only by th... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49835559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1441863/"
] | **Avoid using firewall rules used in some answers on the web, I saw some of them create some kind of allow-all firewall rule (allow any terrafic from any ip and any port), this can cause security problems**
Simply use this single line from [this answer](https://stackoverflow.com/a/70566842/11190169) which worked perfe... | I've tested on **Update for Microsoft Windows(KB4532132)** with reinstalled WSL and it works as expected. Seems the issue was related to old windows version or old WSL version. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.