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
14,303,300
> > **Possible Duplicate:** > > [Python \_\_str\_\_ and lists](https://stackoverflow.com/questions/727761/python-str-and-lists) > > > What is the cause when python prints the address of an object instead of the object itself? for example the output for a print instruction is this: ``` [< ro.domain.entities.P...
2013/01/13
[ "https://Stackoverflow.com/questions/14303300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1796659/" ]
You are looking at the `repr()` representation of a custom class, which by default include the `id()` (== memory address in CPython). This is the default used when printing a list, any contents are included using the representation: ``` >>> class CustomObject(object): ... def __str__(self): ... return "I ...
Python calls for every list item the **repr**() output of each list item. See [Python \_\_str\_\_ and lists](https://stackoverflow.com/questions/727761/python-str-and-lists)
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
Here is a script alternative to `/usr/bin/env`, that permits passing of arguments on the hash-bang line, based on `/bin/bash` and with the restriction that spaces are disallowed in the executable path. I call it "envns" (env No Spaces): ``` #!/bin/bash ARGS=( $1 ) # separate $1 into multiple space-delimited argument...
Building off of Larry Cai's answer, `env` allows you to set a variable directly in the command line. That means that `-u` can be replaced by the equivalent `PYTHONUNBUFFERED` setting before `python`: ``` #!/usr/bin/env PYTHONUNBUFFERED="YESSSSS" python ``` Works on RHEL 6.5. I am pretty sure that feature of `env` is...
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
Building off of Larry Cai's answer, `env` allows you to set a variable directly in the command line. That means that `-u` can be replaced by the equivalent `PYTHONUNBUFFERED` setting before `python`: ``` #!/usr/bin/env PYTHONUNBUFFERED="YESSSSS" python ``` Works on RHEL 6.5. I am pretty sure that feature of `env` is...
I recently wrote a patch for the GNU Coreutils version of `env` to address this issue: <http://lists.gnu.org/archive/html/coreutils/2017-05/msg00018.html> If you have this, you can do: ``` #!/usr/bin/env :lang:--foo:bar ``` `env` will split `:lang:foo:--bar` into the fields `lang`, `foo` and `--bar`. It will searc...
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
Passing arguments to the shebang line is not standard and in as you have experimented do not work in combination with env in Linux. The solution with bash is to use the builtin command "set" to set the required options. I think you can do the same to set unbuffered output of stdin with a python command. my2c
Building off of Larry Cai's answer, `env` allows you to set a variable directly in the command line. That means that `-u` can be replaced by the equivalent `PYTHONUNBUFFERED` setting before `python`: ``` #!/usr/bin/env PYTHONUNBUFFERED="YESSSSS" python ``` Works on RHEL 6.5. I am pretty sure that feature of `env` is...
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
In some environment, env doesn't split arguments. So your env is looking for `python -u` in your path. We can use sh to work around. Replace your shebang with the following code lines and everything will be fine. ``` #!/bin/sh ''''exec python -u -- "$0" ${1+"$@"} # ''' # vi: syntax=python ``` p.s. we need not worry ...
Building off of Larry Cai's answer, `env` allows you to set a variable directly in the command line. That means that `-u` can be replaced by the equivalent `PYTHONUNBUFFERED` setting before `python`: ``` #!/usr/bin/env PYTHONUNBUFFERED="YESSSSS" python ``` Works on RHEL 6.5. I am pretty sure that feature of `env` is...
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
Here is a script alternative to `/usr/bin/env`, that permits passing of arguments on the hash-bang line, based on `/bin/bash` and with the restriction that spaces are disallowed in the executable path. I call it "envns" (env No Spaces): ``` #!/bin/bash ARGS=( $1 ) # separate $1 into multiple space-delimited argument...
This is a kludge and requires bash, but it works: ``` #!/bin/bash python -u <(cat <<"EOF" # Your script here print "Hello world" EOF ) ```
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
This might be a little bit outdated but env(1) manual tells one can use '-S' for that case ``` #!/usr/bin/env -S python -u ``` It seems to work pretty good on FreeBSD.
Here is a script alternative to `/usr/bin/env`, that permits passing of arguments on the hash-bang line, based on `/bin/bash` and with the restriction that spaces are disallowed in the executable path. I call it "envns" (env No Spaces): ``` #!/bin/bash ARGS=( $1 ) # separate $1 into multiple space-delimited argument...
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
Passing arguments to the shebang line is not standard and in as you have experimented do not work in combination with env in Linux. The solution with bash is to use the builtin command "set" to set the required options. I think you can do the same to set unbuffered output of stdin with a python command. my2c
Here is a script alternative to `/usr/bin/env`, that permits passing of arguments on the hash-bang line, based on `/bin/bash` and with the restriction that spaces are disallowed in the executable path. I call it "envns" (env No Spaces): ``` #!/bin/bash ARGS=( $1 ) # separate $1 into multiple space-delimited argument...
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
This might be a little bit outdated but env(1) manual tells one can use '-S' for that case ``` #!/usr/bin/env -S python -u ``` It seems to work pretty good on FreeBSD.
I recently wrote a patch for the GNU Coreutils version of `env` to address this issue: <http://lists.gnu.org/archive/html/coreutils/2017-05/msg00018.html> If you have this, you can do: ``` #!/usr/bin/env :lang:--foo:bar ``` `env` will split `:lang:foo:--bar` into the fields `lang`, `foo` and `--bar`. It will searc...
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
In some environment, env doesn't split arguments. So your env is looking for `python -u` in your path. We can use sh to work around. Replace your shebang with the following code lines and everything will be fine. ``` #!/bin/sh ''''exec python -u -- "$0" ${1+"$@"} # ''' # vi: syntax=python ``` p.s. we need not worry ...
When you use shebang on Linux, the entire rest of the line after the interpreter name is interpreted as a single argument. The `python -u` gets passed to `env` as if you'd typed: `/usr/bin/env 'python -u'`. The `/usr/bin/env` searches for a binary called `python -u`, which there isn't one.
3,306,518
I needed to have a directly executable python script, so i started the file with `#!/usr/bin/env python`. However, I also need unbuffered output, so i tried `#!/usr/bin/env python -u`, but that fails with `python -u: no such file or directory`. I found out that `#/usr/bin/python -u` works, but I need it to get the `py...
2010/07/22
[ "https://Stackoverflow.com/questions/3306518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381048/" ]
When you use shebang on Linux, the entire rest of the line after the interpreter name is interpreted as a single argument. The `python -u` gets passed to `env` as if you'd typed: `/usr/bin/env 'python -u'`. The `/usr/bin/env` searches for a binary called `python -u`, which there isn't one.
Building off of Larry Cai's answer, `env` allows you to set a variable directly in the command line. That means that `-u` can be replaced by the equivalent `PYTHONUNBUFFERED` setting before `python`: ``` #!/usr/bin/env PYTHONUNBUFFERED="YESSSSS" python ``` Works on RHEL 6.5. I am pretty sure that feature of `env` is...
41,020,233
How to get user-defined class attributes from class instance? I tried this: ``` class A: FOO = 'foo' BAR = 'bar' a = A() print(a.__dict__) # {} print(vars(a)) # {} ``` I use python 3.5. Is there a way to get them? I know that `dir(a)` returns a list with names of attributes, but I need only used defined,...
2016/12/07
[ "https://Stackoverflow.com/questions/41020233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7262895/" ]
You've defined those variables within the class namespace which haven't propagated into instances. You can use the `__class__` attribute of the instance to access the class object, and then use the `__dict__` method to get the namespace's contents: ``` >>> {k: v for k, v in a.__class__.__dict__.items() if not k.starts...
Try this: ``` In [5]: [x for x in dir(a) if not x.startswith('__')] Out[5]: ['BAR', 'FOO'] ```
58,499,136
I have a python script which I want to execute when someone clicks on a button in an HTML/PHP web page in the browser. How can this be achieved and what is the best way of doing it?
2019/10/22
[ "https://Stackoverflow.com/questions/58499136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8110933/" ]
You need to use flask server for this requirement as browser can not access local file. By using flask, You need to write Ajax call in `.js`. Sample Ajax call. ``` $(document).ready(function () { $('#<ButtonID>').click(function (event) { $.ajax({ url: '/<Flask URL>', type: 'POST', success: fu...
With `exec`, ``` $command = "python script_path"; exec($command,$output,$return_var); if ($return_var) { $error = error_get_last(); var_dump($error) } ```
62,857,693
How do I install spacy on ARM processor? I get an error ``` ERROR: Command errored out with exit status 1: command: /root/miniforge3/bin/python3.7 /root/miniforge3/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-ahxo0t0p/overlay --no-warn-script-location --no-binary ...
2020/07/12
[ "https://Stackoverflow.com/questions/62857693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/139150/" ]
> > You cannot use "hot reload" features with flutter app because the process of deployment/running never finishes > > > Actually, you can! Just connect to the device with `adb connect <IP>` instead of going through the socket. See my full blog post here: <https://dnmc.in/2021/01/25/setting-up-flutter-natively-wi...
If you are like me you had a lot of issues getting adb to work. You need to make sure that windows host and the linux image both have the same version of adb. Following this guide <https://www.androidexplained.com/install-adb-fastboot/#update> helped me update adb on windows.
66,524,661
Here I check the installed version of pip `py -m pip --version` ``` pip 21.0.1 from C:\Users\hp\AppData\Local\Programs\Python\Python39\lib\site-packages\pip (python 3.9) ``` Now I try to run a pip command `pip install pip --target $HOME\\.pyenv` ``` pip: The term 'pip' is not recognized as a name of a cmdlet, fun...
2021/03/08
[ "https://Stackoverflow.com/questions/66524661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/865220/" ]
Add the scripts folder to PATH `C:\Users\hp\AppData\Local\Programs\Python\Python39\Scripts` or `C:\Python39\Scripts` (depending on how you have installed python locate and add python/scripts folder)
Just use on the terminal: ``` py -m pip install ``` followed by the library you want to install. It tends to work.
19,494,511
``` Error: Error: if n == 0 or n>4: UnboundLocalError: local variable 'n' referenced before assignment. ``` Tried isdigit method, but seems not working. what is the issue ? ``` #!usr/bin/python import sys class Person: def __init__(self, firstname=None, lastname=None, age=None, gender=None): self.fnam...
2013/10/21
[ "https://Stackoverflow.com/questions/19494511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897545/" ]
Okay, you are doing a few things wrong. First of all, `raw_input` will always give you a string. So you need to convert it into an integer anyway. But also, you are using the variable `n` in parts of your code that it might not exist at yet. You need to change this part: ``` print "Not a valid input" if n1....
Your're testing for n == something condition before setting the value of n. Simply initialize it to zero or whatever else default value. ``` def display(self): found = False n = 0 ```
19,494,511
``` Error: Error: if n == 0 or n>4: UnboundLocalError: local variable 'n' referenced before assignment. ``` Tried isdigit method, but seems not working. what is the issue ? ``` #!usr/bin/python import sys class Person: def __init__(self, firstname=None, lastname=None, age=None, gender=None): self.fnam...
2013/10/21
[ "https://Stackoverflow.com/questions/19494511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897545/" ]
``` n = 0 if n1.isdigit(): n = int(n1) else: """If the execution comes here (not n1.isdigit()) the variable `n` will remain undefined. Therefore you should define it in this block or before if, say initially setting it to zero. """ print "Enter Integer only" ``` <http://codepad.org/5PNW...
Your're testing for n == something condition before setting the value of n. Simply initialize it to zero or whatever else default value. ``` def display(self): found = False n = 0 ```
19,494,511
``` Error: Error: if n == 0 or n>4: UnboundLocalError: local variable 'n' referenced before assignment. ``` Tried isdigit method, but seems not working. what is the issue ? ``` #!usr/bin/python import sys class Person: def __init__(self, firstname=None, lastname=None, age=None, gender=None): self.fnam...
2013/10/21
[ "https://Stackoverflow.com/questions/19494511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897545/" ]
Okay, you are doing a few things wrong. First of all, `raw_input` will always give you a string. So you need to convert it into an integer anyway. But also, you are using the variable `n` in parts of your code that it might not exist at yet. You need to change this part: ``` print "Not a valid input" if n1....
``` n = 0 if n1.isdigit(): n = int(n1) else: """If the execution comes here (not n1.isdigit()) the variable `n` will remain undefined. Therefore you should define it in this block or before if, say initially setting it to zero. """ print "Enter Integer only" ``` <http://codepad.org/5PNW...
41,061,824
I have a problem with installing csv package in pycharm (running under python 3.5.2) When I try to install it I get an error saying Executed command: `pip install --user csv` Error occurred: Non-zero exit code (1) Could not find a version that satisfies the requirement csv (from versions: ) No matching distributi...
2016/12/09
[ "https://Stackoverflow.com/questions/41061824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4005127/" ]
You can't `pip install csv` because the csv module is included in the Python installation. You can directly use : ``` import csv ``` in your program Thanks
The problem is that you have another file in your directory called `csv.py`. And in this file you do not have a `reader` function. Change its name to `my_csv.py`
41,061,824
I have a problem with installing csv package in pycharm (running under python 3.5.2) When I try to install it I get an error saying Executed command: `pip install --user csv` Error occurred: Non-zero exit code (1) Could not find a version that satisfies the requirement csv (from versions: ) No matching distributi...
2016/12/09
[ "https://Stackoverflow.com/questions/41061824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4005127/" ]
You can't `pip install csv` because the csv module is included in the Python installation. You can directly use : ``` import csv ``` in your program Thanks
1. 'csv' is an in-built package. So you dont have to install it again in Pycharm. 2. When you try to import csv, make sure that you dont have **any file**(*created by you*) named as 'csv.py' in your project folder(or Python Path Variable folders) because of this you are not actually importing 'csv' package.
41,061,824
I have a problem with installing csv package in pycharm (running under python 3.5.2) When I try to install it I get an error saying Executed command: `pip install --user csv` Error occurred: Non-zero exit code (1) Could not find a version that satisfies the requirement csv (from versions: ) No matching distributi...
2016/12/09
[ "https://Stackoverflow.com/questions/41061824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4005127/" ]
You can't `pip install csv` because the csv module is included in the Python installation. You can directly use : ``` import csv ``` in your program Thanks
for python 3, you should run this command: ``` pip install python-csv ```
41,061,824
I have a problem with installing csv package in pycharm (running under python 3.5.2) When I try to install it I get an error saying Executed command: `pip install --user csv` Error occurred: Non-zero exit code (1) Could not find a version that satisfies the requirement csv (from versions: ) No matching distributi...
2016/12/09
[ "https://Stackoverflow.com/questions/41061824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4005127/" ]
You can't `pip install csv` because the csv module is included in the Python installation. You can directly use : ``` import csv ``` in your program Thanks
You should go to Terminal in PyCharm and type: ``` pip3 install python-csv ```
41,061,824
I have a problem with installing csv package in pycharm (running under python 3.5.2) When I try to install it I get an error saying Executed command: `pip install --user csv` Error occurred: Non-zero exit code (1) Could not find a version that satisfies the requirement csv (from versions: ) No matching distributi...
2016/12/09
[ "https://Stackoverflow.com/questions/41061824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4005127/" ]
The problem is that you have another file in your directory called `csv.py`. And in this file you do not have a `reader` function. Change its name to `my_csv.py`
You should go to Terminal in PyCharm and type: ``` pip3 install python-csv ```
41,061,824
I have a problem with installing csv package in pycharm (running under python 3.5.2) When I try to install it I get an error saying Executed command: `pip install --user csv` Error occurred: Non-zero exit code (1) Could not find a version that satisfies the requirement csv (from versions: ) No matching distributi...
2016/12/09
[ "https://Stackoverflow.com/questions/41061824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4005127/" ]
1. 'csv' is an in-built package. So you dont have to install it again in Pycharm. 2. When you try to import csv, make sure that you dont have **any file**(*created by you*) named as 'csv.py' in your project folder(or Python Path Variable folders) because of this you are not actually importing 'csv' package.
You should go to Terminal in PyCharm and type: ``` pip3 install python-csv ```
41,061,824
I have a problem with installing csv package in pycharm (running under python 3.5.2) When I try to install it I get an error saying Executed command: `pip install --user csv` Error occurred: Non-zero exit code (1) Could not find a version that satisfies the requirement csv (from versions: ) No matching distributi...
2016/12/09
[ "https://Stackoverflow.com/questions/41061824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4005127/" ]
for python 3, you should run this command: ``` pip install python-csv ```
You should go to Terminal in PyCharm and type: ``` pip3 install python-csv ```
47,900,257
I have the Python Extensions for Windows installed. Within the PythonWin IDE I can get autocomplete on Automation objects (specifically, objects created with `win32com.client.Dispatch`): [![PythonWin IDE with autocomplete](https://i.stack.imgur.com/uxxkh.png)](https://i.stack.imgur.com/uxxkh.png) How can I get the sa...
2017/12/20
[ "https://Stackoverflow.com/questions/47900257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111794/" ]
I don't think that the example you show with `PythonWin` is easily reproducible in VS Code. The quick start guide of `win32com` itself (cited below) says, its only possible with a COM browser or the documentation of the product (Word in this case). The latter one is unlikely, so `PythonWin` is probably using a COM brow...
I think your problem is related to defining `Python interpreter`. Choose proper Python interpreter by executing `python interpreter` command in `VS Code` command palette by pressing **`f1`** or **`ctrl+shift+p`** key.
47,900,257
I have the Python Extensions for Windows installed. Within the PythonWin IDE I can get autocomplete on Automation objects (specifically, objects created with `win32com.client.Dispatch`): [![PythonWin IDE with autocomplete](https://i.stack.imgur.com/uxxkh.png)](https://i.stack.imgur.com/uxxkh.png) How can I get the sa...
2017/12/20
[ "https://Stackoverflow.com/questions/47900257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111794/" ]
*Review* I have confirmed your problem in VSCode, although it may be possible IntelliSense works fine. Note Ctrl+Space invokes suggestions for a *pre-defined* variable: [![enter image description here](https://i.stack.imgur.com/B9Zq2.png)](https://i.stack.imgur.com/B9Zq2.png) However, there does not appear to be pub...
I think your problem is related to defining `Python interpreter`. Choose proper Python interpreter by executing `python interpreter` command in `VS Code` command palette by pressing **`f1`** or **`ctrl+shift+p`** key.
12,756,885
I've looked at all the other questions like this and they all seem to be a slight variation of this one in which I can't extract an answer for my problem. ``` >>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named numpy ``` So I installed it with homeb...
2012/10/06
[ "https://Stackoverflow.com/questions/12756885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1217616/" ]
Third-party add-ons ("distributions") to Python, like `numpy`, are installed to a particular instance of Python. On OS X 10.8 (Mountain Lion), the Apple-supplied Python 2.7 comes with a version of `numpy` pre-installed. You can access that python with: ``` /usr/bin/python2.7 ``` I'm not sure what you mean by "downlo...
If Your Numpy not install during python 2.7 installation so you can download numpy and install easly from this link [install link](http://www.iram.fr/IRAMFR/GILDAS/doc/html/gildas-python-html/node38.html)
29,786,474
I execute `launchctl start com.xxx.xxx.plist` I can find `AutoMakeLog.err` and the content : ``` Traceback (most recent call last): File "/Users/xxxx/Downloads/Kevin/auto.py", line 67, in <module> output = open(file_name, 'w') IOError: [Errno 13] Permission denied: '2015-04-22-09:15:40.log' ``` plist content : ```...
2015/04/22
[ "https://Stackoverflow.com/questions/29786474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1327056/" ]
`int[]` is an `integer array` type. `int` is an `integer` type. You can't convert an array to a number.
You have multiple problems in the code. declare int as integer, initialise Questions and You have to convert String to integer before assigning it to question. ``` int i = 0; int [] question = new int [100]; question[i++] = Integer.parseInt(line[0]); ```
29,786,474
I execute `launchctl start com.xxx.xxx.plist` I can find `AutoMakeLog.err` and the content : ``` Traceback (most recent call last): File "/Users/xxxx/Downloads/Kevin/auto.py", line 67, in <module> output = open(file_name, 'w') IOError: [Errno 13] Permission denied: '2015-04-22-09:15:40.log' ``` plist content : ```...
2015/04/22
[ "https://Stackoverflow.com/questions/29786474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1327056/" ]
You have declared variable `i` as an `int` array and using it to track index of `question[]`. Indices in arrays are represented by 0,1,2,3... which are of type regular `int` and not `int[]`. So you're getting the error `int[] cannot be converted to int` **Solution:** Change `int[] i = new int[0];` to `int i = 0;` An...
You have multiple problems in the code. declare int as integer, initialise Questions and You have to convert String to integer before assigning it to question. ``` int i = 0; int [] question = new int [100]; question[i++] = Integer.parseInt(line[0]); ```
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
i'd forget the port number to enter the port, this is the URL connection string: ``` `SQLALCHEMY_DATABASE_URI = 'mysql://dt_admin:dt2016@localhost:3308/dreamteam_db' ``` it work now, thanks
For me I got this error once I was trying to fix this issue ``` raise TypeError("option values must be strings") TypeError: option values must be strings ``` so I tried to stringify the url like so ```py config.set_main_option( "sqlalchemy.url", f'{os.environ.get("DATABASE_URL")}') ``` After that I got new e...
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
You are not using a valid URL in the connection string. Review the documentation on how the MySQL connection URLs need to be structured: <http://docs.sqlalchemy.org/en/latest/dialects/mysql.html>. Depending on the MySQL driver that you use the connection URL is different. For example, if you use pymysql, your URL sho...
make sure that there is no space or newline in the **URI** string
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
URL in the connection string is not valid. you can check the documentation on how the MySQL connection URLs need to be structured here : <http://docs.sqlalchemy.org/en/latest/dialects/mysql.html>. Example syntax for postgresql with psycopg2 driver it look like this :- ``` sql_alchemy_conn = postgresql+psycopg2://ubu...
For me I got this error once I was trying to fix this issue ``` raise TypeError("option values must be strings") TypeError: option values must be strings ``` so I tried to stringify the url like so ```py config.set_main_option( "sqlalchemy.url", f'{os.environ.get("DATABASE_URL")}') ``` After that I got new e...
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
You are not using a valid URL in the connection string. Review the documentation on how the MySQL connection URLs need to be structured: <http://docs.sqlalchemy.org/en/latest/dialects/mysql.html>. Depending on the MySQL driver that you use the connection URL is different. For example, if you use pymysql, your URL sho...
For me I got this error once I was trying to fix this issue ``` raise TypeError("option values must be strings") TypeError: option values must be strings ``` so I tried to stringify the url like so ```py config.set_main_option( "sqlalchemy.url", f'{os.environ.get("DATABASE_URL")}') ``` After that I got new e...
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
make sure that there is no space or newline in the **URI** string
For me I got this error once I was trying to fix this issue ``` raise TypeError("option values must be strings") TypeError: option values must be strings ``` so I tried to stringify the url like so ```py config.set_main_option( "sqlalchemy.url", f'{os.environ.get("DATABASE_URL")}') ``` After that I got new e...
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
You are not using a valid URL in the connection string. Review the documentation on how the MySQL connection URLs need to be structured: <http://docs.sqlalchemy.org/en/latest/dialects/mysql.html>. Depending on the MySQL driver that you use the connection URL is different. For example, if you use pymysql, your URL sho...
URL in the connection string is not valid. you can check the documentation on how the MySQL connection URLs need to be structured here : <http://docs.sqlalchemy.org/en/latest/dialects/mysql.html>. Example syntax for postgresql with psycopg2 driver it look like this :- ``` sql_alchemy_conn = postgresql+psycopg2://ubu...
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
i'd forget the port number to enter the port, this is the URL connection string: ``` `SQLALCHEMY_DATABASE_URI = 'mysql://dt_admin:dt2016@localhost:3308/dreamteam_db' ``` it work now, thanks
just had to remove the quotes I was using like that: ``` sql_alchemy_conn = 'postgresql://user:password@host:port/db' ``` And this worked: ``` sql_alchemy_conn = postgresql://user:password@host:port/db ```
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
You are not using a valid URL in the connection string. Review the documentation on how the MySQL connection URLs need to be structured: <http://docs.sqlalchemy.org/en/latest/dialects/mysql.html>. Depending on the MySQL driver that you use the connection URL is different. For example, if you use pymysql, your URL sho...
just had to remove the quotes I was using like that: ``` sql_alchemy_conn = 'postgresql://user:password@host:port/db' ``` And this worked: ``` sql_alchemy_conn = postgresql://user:password@host:port/db ```
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
i'd forget the port number to enter the port, this is the URL connection string: ``` `SQLALCHEMY_DATABASE_URI = 'mysql://dt_admin:dt2016@localhost:3308/dreamteam_db' ``` it work now, thanks
URL in the connection string is not valid. you can check the documentation on how the MySQL connection URLs need to be structured here : <http://docs.sqlalchemy.org/en/latest/dialects/mysql.html>. Example syntax for postgresql with psycopg2 driver it look like this :- ``` sql_alchemy_conn = postgresql+psycopg2://ubu...
49,776,619
I'm learning flask web microframework and after initialization of my database I run `flask db init` I run `flask db migrate`, to migrate my models classes to the database and i got an error. I work on Windows 10, the database is MySQL, and extensions install are `flask-migrate`, `flask-sqlalchemy`, `flask-login`. ``` ...
2018/04/11
[ "https://Stackoverflow.com/questions/49776619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8559808/" ]
i'd forget the port number to enter the port, this is the URL connection string: ``` `SQLALCHEMY_DATABASE_URI = 'mysql://dt_admin:dt2016@localhost:3308/dreamteam_db' ``` it work now, thanks
make sure that there is no space or newline in the **URI** string
50,126,064
I've been learning about about C++ in college and one thing that interests me is the ability to create a shared header file so that all the cpp files can access the objects within. I was wondering if there is some way to do the same thing in python with variables and constants? I only know how to import and use the fun...
2018/05/02
[ "https://Stackoverflow.com/questions/50126064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7944978/" ]
First, if you've ever used `sys.argv` or `os.sep`, you've already used another module's variables and constants. Because the way you share variables and constants is exactly the same way you share functions and classes. In fact, functions, classes, variables, constants—they're all just module-global variables as far ...
If you are just looking to make function definitions, then this post may answer your question: [Python: How to import other Python files](https://stackoverflow.com/questions/2349991/python-how-to-import-other-python-files) Then you can define a function as per here: <https://www.tutorialspoint.com/python/python_func...
5,971,635
My python script which calls many python functions and shell scripts. I want to set a environment variable in Python (main calling function) and all the daughter processes including the shell scripts to see the environmental variable set. I need to set some environmental variables like this: ``` DEBUSSY 1 FSDB 1 ```...
2011/05/11
[ "https://Stackoverflow.com/questions/5971635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749632/" ]
Try using the `os` module. ``` import os os.environ['DEBUSSY'] = '1' os.environ['FSDB'] = '1' # Open child processes via os.system(), popen() or fork() and execv() someVariable = int(os.environ['DEBUSSY']) ``` See the [Python docs](http://docs.python.org/library/os.html#os.environ) on `os.environ`. Also, for spaw...
Use `os.environ[str(DEBUSSY)]` for both reading and writing (<http://docs.python.org/library/os.html#os.environ>). As for reading, you have to parse the number from the string yourself of course.
5,971,635
My python script which calls many python functions and shell scripts. I want to set a environment variable in Python (main calling function) and all the daughter processes including the shell scripts to see the environmental variable set. I need to set some environmental variables like this: ``` DEBUSSY 1 FSDB 1 ```...
2011/05/11
[ "https://Stackoverflow.com/questions/5971635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749632/" ]
Try using the `os` module. ``` import os os.environ['DEBUSSY'] = '1' os.environ['FSDB'] = '1' # Open child processes via os.system(), popen() or fork() and execv() someVariable = int(os.environ['DEBUSSY']) ``` See the [Python docs](http://docs.python.org/library/os.html#os.environ) on `os.environ`. Also, for spaw...
First things first :) reading books is an *excellent* approach to problem solving; it's the difference between band-aid fixes and long-term investments in solving problems. Never miss an opportunity to learn. :D You might *choose* to interpret the `1` as a number, but environment variables don't care. They just pass a...
5,971,635
My python script which calls many python functions and shell scripts. I want to set a environment variable in Python (main calling function) and all the daughter processes including the shell scripts to see the environmental variable set. I need to set some environmental variables like this: ``` DEBUSSY 1 FSDB 1 ```...
2011/05/11
[ "https://Stackoverflow.com/questions/5971635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749632/" ]
Try using the `os` module. ``` import os os.environ['DEBUSSY'] = '1' os.environ['FSDB'] = '1' # Open child processes via os.system(), popen() or fork() and execv() someVariable = int(os.environ['DEBUSSY']) ``` See the [Python docs](http://docs.python.org/library/os.html#os.environ) on `os.environ`. Also, for spaw...
If you want to pass global variables into new scripts, you can create a python file that is only meant for holding global variables (e.g. globals.py). When you import this file at the top of the child script, it should have access to all of those variables. If you are writing to these variables, then that is a differe...
5,971,635
My python script which calls many python functions and shell scripts. I want to set a environment variable in Python (main calling function) and all the daughter processes including the shell scripts to see the environmental variable set. I need to set some environmental variables like this: ``` DEBUSSY 1 FSDB 1 ```...
2011/05/11
[ "https://Stackoverflow.com/questions/5971635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749632/" ]
First things first :) reading books is an *excellent* approach to problem solving; it's the difference between band-aid fixes and long-term investments in solving problems. Never miss an opportunity to learn. :D You might *choose* to interpret the `1` as a number, but environment variables don't care. They just pass a...
Use `os.environ[str(DEBUSSY)]` for both reading and writing (<http://docs.python.org/library/os.html#os.environ>). As for reading, you have to parse the number from the string yourself of course.
5,971,635
My python script which calls many python functions and shell scripts. I want to set a environment variable in Python (main calling function) and all the daughter processes including the shell scripts to see the environmental variable set. I need to set some environmental variables like this: ``` DEBUSSY 1 FSDB 1 ```...
2011/05/11
[ "https://Stackoverflow.com/questions/5971635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749632/" ]
If you want to pass global variables into new scripts, you can create a python file that is only meant for holding global variables (e.g. globals.py). When you import this file at the top of the child script, it should have access to all of those variables. If you are writing to these variables, then that is a differe...
Use `os.environ[str(DEBUSSY)]` for both reading and writing (<http://docs.python.org/library/os.html#os.environ>). As for reading, you have to parse the number from the string yourself of course.
5,971,635
My python script which calls many python functions and shell scripts. I want to set a environment variable in Python (main calling function) and all the daughter processes including the shell scripts to see the environmental variable set. I need to set some environmental variables like this: ``` DEBUSSY 1 FSDB 1 ```...
2011/05/11
[ "https://Stackoverflow.com/questions/5971635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/749632/" ]
First things first :) reading books is an *excellent* approach to problem solving; it's the difference between band-aid fixes and long-term investments in solving problems. Never miss an opportunity to learn. :D You might *choose* to interpret the `1` as a number, but environment variables don't care. They just pass a...
If you want to pass global variables into new scripts, you can create a python file that is only meant for holding global variables (e.g. globals.py). When you import this file at the top of the child script, it should have access to all of those variables. If you are writing to these variables, then that is a differe...
3,148,352
Need Help Creating GAE Datastore Loader Class for uploading data using appcfg.py? Any other way to simplified this process? is there any detailed example better than [here](http://code.google.com/appengine/docs/python/tools/uploadingdata.html) When try using bulkloader.yaml: ``` Uploading data records. [INFO ] Log...
2010/06/30
[ "https://Stackoverflow.com/questions/3148352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/288541/" ]
I've created config.yaml with bulkloader config, and also written simple helper function to process None-references. I don't know why it's not done in original helper. The helper (file `helpers.py` is very simple, just place it to the same directory where you placed `config.yaml`): ``` from google.appengine.api impor...
It looks like you have reference properties with None values, such values are handled incorrectly by bulkloader's helpers.
68,490,787
Any time I make a change in the view, and HTML, or CSS, I have to stop and re-run ``` python manage.py runserver ``` for my changes to be dispayed. This is very annoying because it wastes a lot of my time trying to find the terminal and run it again. Is there a workaround for this?
2021/07/22
[ "https://Stackoverflow.com/questions/68490787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14296523/" ]
`python manage.py runserver` should normally perform hot reload on your Django application, except you've updated the config in the settings.py file. Check if `DEBUG = True` in settings.py
My advice is to use Vscode for Django developing because it gives you autosave feature so you don't have to stop and rerun the server the only thing you have to do is reload the web page. I hope it might be helpful
11,590,082
I am using python and sqlite3 to handle a website. I need all timezones to be in localtime, and I need daylight savings to be accounted for. The ideal method to do this would be to use sqlite to set a global datetime('now') to be +10 hours. If I can work out how to change sqlite's 'now' with a command, then I was goin...
2012/07/21
[ "https://Stackoverflow.com/questions/11590082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1503619/" ]
I'm not 100% on what you're asking, but to keep this simple I would say store your dates in UTC, and present them as local time if need be: ``` sqlite> select datetime('now', 'utc'); 2012-07-21 09:58:21 sqlite> select datetime('now', 'localtime'); 2012-07-21 13:58:33 ``` See SQLite's [date and time functions documen...
you can try this code, I am in Taiwan , so I add 8 hours: `DateTime('now','+8 hours')`
9,597,122
I have established a basic hadoop master slave cluster setup and able to run mapreduce programs (including python) on the cluster. Now I am trying to run a python code which accesses a C binary and so I am using the subprocess module. I am able to use the hadoop streaming for a normal python code but when I include t...
2012/03/07
[ "https://Stackoverflow.com/questions/9597122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1253987/" ]
Used simple id and hash token like Amazon for now...
Your site can absolutely be an OAuth server (to clients) and an OAuth consumer (of other APIs) at the same time, the same way that a hairdresser can also be the customer of another hairdresser.
72,720,385
I created a model like this. ``` class BloodDiscard(models.Model): timestamp = models.DateTimeField(auto_now_add=True, blank=True) created_by = models.ForeignKey(Registration, on_delete=models.SET_NULL, null=True) blood_group = models.ForeignKey(BloodGroupMaster, on_delete=models.SET_NULL, null=True) b...
2022/06/22
[ "https://Stackoverflow.com/questions/72720385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15809668/" ]
You can use the `matplotlib`'s `Dateformatter`. Updated code and plot below. I did notice that the `Date` column you posted had dates on 2nd and 17th. I changed those to show everything on the 2nd. Otherwise, there would be too many entries. Hope this helps... ``` df = pd.DataFrame({"Date":["2015-02-02 10:19:00","2015...
You would want to convert your ['Date'] column to only include time information, im not sure if you want the data to be ordered by date or not but that should just show time information on the X-axis: ``` df['Date'].dt.time ```
5,043,188
i have a trouble with run django project on production server with Apache and mod\_wsgi. This Error happened when i'm start apache and go to site first time or go from other: > > ImportError at / > > Exception Value: cannot import name MyName > > Exception Location /var/www/projectname/appname/somemodule.py >...
2011/02/18
[ "https://Stackoverflow.com/questions/5043188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337077/" ]
``` php -i | more ``` should work on both Linux and Unix. On Linux, though, `more` is simply an alias for the equivalent `less`
On Linux you could do from the shell ``` php -r "phpinfo();" | less ```
33,124,269
I have been following a Caffe example [here](http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb) to plot the Convolution kernels from my ConvNet. I have attached an image below of my kernels, however it looks nothing like the kernels in the example. I have followed the example ex...
2015/10/14
[ "https://Stackoverflow.com/questions/33124269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321075/" ]
Twilio developer evangelist here. You absolutely can do app to app calls using the iOS SDK. Let me explain. Your Twilio Client capability token is created with a TwiML Application, which supplies the URL that Twilio will hit when a call is created to find out what to do with it. Normally, you would pass a phone numbe...
Not sure it is possible with Twilio. We have used twilio for the same purpose u mentioned (Call to phone numbers) and was working fine. I think the main purpose of twilio is that. Anyways i'm not sure about it. May be [VoIP](https://en.wikipedia.org/wiki/Voice_over_IP) will suit for your functionality. **PortSIP** is ...
33,124,269
I have been following a Caffe example [here](http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb) to plot the Convolution kernels from my ConvNet. I have attached an image below of my kernels, however it looks nothing like the kernels in the example. I have followed the example ex...
2015/10/14
[ "https://Stackoverflow.com/questions/33124269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5321075/" ]
Twilio developer evangelist here. You absolutely can do app to app calls using the iOS SDK. Let me explain. Your Twilio Client capability token is created with a TwiML Application, which supplies the URL that Twilio will hit when a call is created to find out what to do with it. Normally, you would pass a phone numbe...
Twilio support sip now. you must have some setting with your twilio account. As I know ,you can follow [here](https://www.twilio.com/docs/voice/api/sending-sip) to set your twilio sip server and implement sip client on your ios client.
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
This recursive method will scan all directories within a given directory and then print the names of the `txt` files. I kindly invite you to take it forward. ``` import os def scan_folder(parent): # iterate over all the files in directory 'parent' for file_name in os.listdir(parent): if file_name.ends...
This code will look for all directories inside a directory, printing out the names of all files found there: ``` #--------*---------*---------*---------*---------*---------*---------*---------* # Desc: print filenames one level down from starting folder #--------*---------*---------*---------*---------*---------*-----...
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
This recursive method will scan all directories within a given directory and then print the names of the `txt` files. I kindly invite you to take it forward. ``` import os def scan_folder(parent): # iterate over all the files in directory 'parent' for file_name in os.listdir(parent): if file_name.ends...
I think nice way to do that would be to use os.walk. That will generate tree and you can then iterate through that tree. ``` import os directory = './' for d in os.walk(directory): print(d) ```
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
Your `glob()` pattern is almost correct. Try one of these: ``` file_open = glob.glob("home/....../*/*.txt") file_open = glob.glob("home/....../folder*/*.txt") ``` The first one will examine all of the text files in any first-level subdirectory of `home/......`, whatever that is. The second will limit itself to subdi...
[pathlib](https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob) is a good choose ``` from pathlib import Path # or use: glob('**/*.txt') for txt_path in [_ for _ in Path('demo/test_dir').rglob('*.txt') if _.is_file()]: print(txt_path.absolute()) ```
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
This recursive method will scan all directories within a given directory and then print the names of the `txt` files. I kindly invite you to take it forward. ``` import os def scan_folder(parent): # iterate over all the files in directory 'parent' for file_name in os.listdir(parent): if file_name.ends...
Given the following folder/file tree: ``` C:. ├───folder1 │ file1.txt │ file2.txt │ file3.csv │ └───folder2 file4.txt file5.txt file6.csv ``` The following code will recursively locate all `.txt` files in the tree: ``` import os import fnmatch for path,dirs,files in os.wal...
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
Given the following folder/file tree: ``` C:. ├───folder1 │ file1.txt │ file2.txt │ file3.csv │ └───folder2 file4.txt file5.txt file6.csv ``` The following code will recursively locate all `.txt` files in the tree: ``` import os import fnmatch for path,dirs,files in os.wal...
This code will look for all directories inside a directory, printing out the names of all files found there: ``` #--------*---------*---------*---------*---------*---------*---------*---------* # Desc: print filenames one level down from starting folder #--------*---------*---------*---------*---------*---------*-----...
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
This recursive method will scan all directories within a given directory and then print the names of the `txt` files. I kindly invite you to take it forward. ``` import os def scan_folder(parent): # iterate over all the files in directory 'parent' for file_name in os.listdir(parent): if file_name.ends...
Your `glob()` pattern is almost correct. Try one of these: ``` file_open = glob.glob("home/....../*/*.txt") file_open = glob.glob("home/....../folder*/*.txt") ``` The first one will examine all of the text files in any first-level subdirectory of `home/......`, whatever that is. The second will limit itself to subdi...
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
Your `glob()` pattern is almost correct. Try one of these: ``` file_open = glob.glob("home/....../*/*.txt") file_open = glob.glob("home/....../folder*/*.txt") ``` The first one will examine all of the text files in any first-level subdirectory of `home/......`, whatever that is. The second will limit itself to subdi...
I think nice way to do that would be to use os.walk. That will generate tree and you can then iterate through that tree. ``` import os directory = './' for d in os.walk(directory): print(d) ```
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
This recursive method will scan all directories within a given directory and then print the names of the `txt` files. I kindly invite you to take it forward. ``` import os def scan_folder(parent): # iterate over all the files in directory 'parent' for file_name in os.listdir(parent): if file_name.ends...
[pathlib](https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob) is a good choose ``` from pathlib import Path # or use: glob('**/*.txt') for txt_path in [_ for _ in Path('demo/test_dir').rglob('*.txt') if _.is_file()]: print(txt_path.absolute()) ```
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
Your `glob()` pattern is almost correct. Try one of these: ``` file_open = glob.glob("home/....../*/*.txt") file_open = glob.glob("home/....../folder*/*.txt") ``` The first one will examine all of the text files in any first-level subdirectory of `home/......`, whatever that is. The second will limit itself to subdi...
This code will look for all directories inside a directory, printing out the names of all files found there: ``` #--------*---------*---------*---------*---------*---------*---------*---------* # Desc: print filenames one level down from starting folder #--------*---------*---------*---------*---------*---------*-----...
49,135,963
I am new to python and currently work on data analysis. I am trying to open multiple folders in a loop and read all files in folders. Ex. working directory contains 10 folders needed to open and each folder contains 10 files. My code for open each folder with .txt file; ``` file_open = glob.glob("home/....../folder...
2018/03/06
[ "https://Stackoverflow.com/questions/49135963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9452236/" ]
Given the following folder/file tree: ``` C:. ├───folder1 │ file1.txt │ file2.txt │ file3.csv │ └───folder2 file4.txt file5.txt file6.csv ``` The following code will recursively locate all `.txt` files in the tree: ``` import os import fnmatch for path,dirs,files in os.wal...
I think nice way to do that would be to use os.walk. That will generate tree and you can then iterate through that tree. ``` import os directory = './' for d in os.walk(directory): print(d) ```
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Those are the basic pieces of information. Anything beyond that could be viewed as SpyWare-like and privacy advocates will [justifiably] frown upon it. The best way to obtain more information from your users is to ask them, make the fields optional, and inform your user of exactly what you will be using the informatio...
For what end? Remember that client IP is close to meaningless now. All users coming from the same proxy or same NAT point would have the same client IP. Years go, all of AOL traffic came from just a few proxies, though now actual AOL users may be outnumbered by the proxies :). If you want to uniquely identify a user...
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The list that is available to PHP is found [here](http://www.php.net/manual/en/reserved.variables.server.php). If you need more details than that, you might want to consider using [Browserhawk](http://www.cyscape.com/).
``` phpinfo(32); ``` Prints a table with the whole extractable information. You can simply copy and paste the variables directly into your php code. e.g: ``` _SERVER["GEOIP_COUNTRY_CODE"] AT ``` would be in php code: ``` echo $_SERVER["GEOIP_COUNTRY_CODE"]; ```
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Get all the information of client's machine with this small PHP: ``` <?php foreach($_SERVER as $key => $value){ echo '$_SERVER["'.$key.'"] = '.$value."<br />"; } ?> ```
For what end? Remember that client IP is close to meaningless now. All users coming from the same proxy or same NAT point would have the same client IP. Years go, all of AOL traffic came from just a few proxies, though now actual AOL users may be outnumbered by the proxies :). If you want to uniquely identify a user...
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The list that is available to PHP is found [here](http://www.php.net/manual/en/reserved.variables.server.php). If you need more details than that, you might want to consider using [Browserhawk](http://www.cyscape.com/).
For what end? Remember that client IP is close to meaningless now. All users coming from the same proxy or same NAT point would have the same client IP. Years go, all of AOL traffic came from just a few proxies, though now actual AOL users may be outnumbered by the proxies :). If you want to uniquely identify a user...
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Those are the basic pieces of information. Anything beyond that could be viewed as SpyWare-like and privacy advocates will [justifiably] frown upon it. The best way to obtain more information from your users is to ask them, make the fields optional, and inform your user of exactly what you will be using the informatio...
get all the outputs of $\_SERVER variables: ``` <?php $test_HTTP_proxy_headers = array('GATEWAY_INTERFACE','SERVER_ADDR','SERVER_NAME','SERVER_SOFTWARE','SERVER_PROTOCOL','REQUEST_METHOD','REQUEST_TIME','REQUEST_TIME_FLOAT','QUERY_STRING','DOCUMENT_ROOT','HTTP_ACCEPT','HTTP_ACCEPT_CHARSET','HTTP_ACCEPT_ENCODING','HTTP...
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Get all the information of client's machine with this small PHP: ``` <?php foreach($_SERVER as $key => $value){ echo '$_SERVER["'.$key.'"] = '.$value."<br />"; } ?> ```
get all the outputs of $\_SERVER variables: ``` <?php $test_HTTP_proxy_headers = array('GATEWAY_INTERFACE','SERVER_ADDR','SERVER_NAME','SERVER_SOFTWARE','SERVER_PROTOCOL','REQUEST_METHOD','REQUEST_TIME','REQUEST_TIME_FLOAT','QUERY_STRING','DOCUMENT_ROOT','HTTP_ACCEPT','HTTP_ACCEPT_CHARSET','HTTP_ACCEPT_ENCODING','HTTP...
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
For what end? Remember that client IP is close to meaningless now. All users coming from the same proxy or same NAT point would have the same client IP. Years go, all of AOL traffic came from just a few proxies, though now actual AOL users may be outnumbered by the proxies :). If you want to uniquely identify a user...
get all the outputs of $\_SERVER variables: ``` <?php $test_HTTP_proxy_headers = array('GATEWAY_INTERFACE','SERVER_ADDR','SERVER_NAME','SERVER_SOFTWARE','SERVER_PROTOCOL','REQUEST_METHOD','REQUEST_TIME','REQUEST_TIME_FLOAT','QUERY_STRING','DOCUMENT_ROOT','HTTP_ACCEPT','HTTP_ACCEPT_CHARSET','HTTP_ACCEPT_ENCODING','HTTP...
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Those are the basic pieces of information. Anything beyond that could be viewed as SpyWare-like and privacy advocates will [justifiably] frown upon it. The best way to obtain more information from your users is to ask them, make the fields optional, and inform your user of exactly what you will be using the informatio...
The list that is available to PHP is found [here](http://www.php.net/manual/en/reserved.variables.server.php). If you need more details than that, you might want to consider using [Browserhawk](http://www.cyscape.com/).
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Those are the basic pieces of information. Anything beyond that could be viewed as SpyWare-like and privacy advocates will [justifiably] frown upon it. The best way to obtain more information from your users is to ask them, make the fields optional, and inform your user of exactly what you will be using the informatio...
``` phpinfo(32); ``` Prints a table with the whole extractable information. You can simply copy and paste the variables directly into your php code. e.g: ``` _SERVER["GEOIP_COUNTRY_CODE"] AT ``` would be in php code: ``` echo $_SERVER["GEOIP_COUNTRY_CODE"]; ```
6,131,629
I'm trying to create a module that initializes a serial port connection using python: ``` import serial class myserial: def __init__(self, port, baudrate) self = serial.Serial(port, baudrate) ``` When I run this in Python I get an AttributeError message stating that self does not have an attribute open. D...
2011/05/25
[ "https://Stackoverflow.com/questions/6131629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Get all the information of client's machine with this small PHP: ``` <?php foreach($_SERVER as $key => $value){ echo '$_SERVER["'.$key.'"] = '.$value."<br />"; } ?> ```
``` phpinfo(32); ``` Prints a table with the whole extractable information. You can simply copy and paste the variables directly into your php code. e.g: ``` _SERVER["GEOIP_COUNTRY_CODE"] AT ``` would be in php code: ``` echo $_SERVER["GEOIP_COUNTRY_CODE"]; ```
24,751,181
I have a text file named headerValue.txt which contains the following data:- ``` Name Age sam 22 Bob 21 ``` I am trying to write a python script that would add a new header called 'Eligibility'. It would read the lines from the text file and check if the age is more than 18, then it will print 'True' underne...
2014/07/15
[ "https://Stackoverflow.com/questions/24751181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3559954/" ]
``` fo =open("headerValue.txt", "r") data = [l.split() for l in fo.readlines()] headers = data[0] headers.extend(('Eligibility', 'Adult')) ageind = headers.index('Age') for line in data[1:]: if int(line[ageind]) > 18: line.extend(('True', 'yes')) else: line.extend(('False', 'no')) ``` The `if`...
This module is suited for you : <https://docs.python.org/2/library/fileinput.html?highlight=fileinput#fileinput> For a infile edition you can use: ``` #!/usr/bin/python import fileinput cont = 0 for line in fileinput.input("./path/to/file", inplace=True): if not cont: name = "Name" age = "Age" ...
24,751,181
I have a text file named headerValue.txt which contains the following data:- ``` Name Age sam 22 Bob 21 ``` I am trying to write a python script that would add a new header called 'Eligibility'. It would read the lines from the text file and check if the age is more than 18, then it will print 'True' underne...
2014/07/15
[ "https://Stackoverflow.com/questions/24751181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3559954/" ]
You're trying to check if the string `"Age"` exists in a line. It only exists on the first line. Then you try to convert a variable `Age` to an integer and see if it's larger than 18. I can't see that you've defined `Age` anywhere so I can't tell if this code runs. It seems like you have a tab-delimited or a space-del...
This module is suited for you : <https://docs.python.org/2/library/fileinput.html?highlight=fileinput#fileinput> For a infile edition you can use: ``` #!/usr/bin/python import fileinput cont = 0 for line in fileinput.input("./path/to/file", inplace=True): if not cont: name = "Name" age = "Age" ...
24,751,181
I have a text file named headerValue.txt which contains the following data:- ``` Name Age sam 22 Bob 21 ``` I am trying to write a python script that would add a new header called 'Eligibility'. It would read the lines from the text file and check if the age is more than 18, then it will print 'True' underne...
2014/07/15
[ "https://Stackoverflow.com/questions/24751181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3559954/" ]
``` fo =open("headerValue.txt", "r") data = [l.split() for l in fo.readlines()] headers = data[0] headers.extend(('Eligibility', 'Adult')) ageind = headers.index('Age') for line in data[1:]: if int(line[ageind]) > 18: line.extend(('True', 'yes')) else: line.extend(('False', 'no')) ``` The `if`...
You're trying to check if the string `"Age"` exists in a line. It only exists on the first line. Then you try to convert a variable `Age` to an integer and see if it's larger than 18. I can't see that you've defined `Age` anywhere so I can't tell if this code runs. It seems like you have a tab-delimited or a space-del...
67,665,789
Hi I am a Newbie to programming. So I spent 4 days trying to learn python. I evented some new swear words too. I was particularly interested in trying as an exercise some web-scraping to learn something new and get some exposure to see how it all works. This is what I came up with. See code at end. It works (to a degre...
2021/05/24
[ "https://Stackoverflow.com/questions/67665789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16011875/" ]
In this case, to do pagination, instead of `for i in range(1, 100)` which is a hardcoded way of paging, it's better to use a `while` loop to dynamically paginate all possible pages. "While" is an infinite loop and it will be executed until the transition to the next page is possible, in this case it will check for the...
Create the URL by putting the page number in it, then put the rest of your code into a `for` loop and you can use `len(winenames)` to count how many results you have. You should do the writing outside the `for` loop. Here's your code with those changes: ```py import requests import csv from bs4 import BeautifulSoup n...
70,883,363
I am working on a python project that depends on some other files. It all works fine while testing. However, I want the program to run on start up. The working directory for programs that run on start up seems to be `C:Windows\system32`. When installing a program, it usually asks where to install it and no matter where...
2022/01/27
[ "https://Stackoverflow.com/questions/70883363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12209262/" ]
> > But now the project grade file seems different. > > > Yes, starting with the new [Bumblebee](https://android-developers.googleblog.com/2022/01/android-studio-bumblebee-202111-stable.html) update of Android Studio, the build.gradle (Project) file is changed. In order to be able to use Google Services, you have ...
I've had the same problem just add in the gradle.build project > > id 'com.google.gms.google-services' version '4.3.0' apply false > > > and then add in gradle.build module > > dependencies { > //Regular dependecies > implementation platform("com.google.firebase:firebase-bom:30.4.0") > implementation "com.googl...
70,883,363
I am working on a python project that depends on some other files. It all works fine while testing. However, I want the program to run on start up. The working directory for programs that run on start up seems to be `C:Windows\system32`. When installing a program, it usually asks where to install it and no matter where...
2022/01/27
[ "https://Stackoverflow.com/questions/70883363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12209262/" ]
> > But now the project grade file seems different. > > > Yes, starting with the new [Bumblebee](https://android-developers.googleblog.com/2022/01/android-studio-bumblebee-202111-stable.html) update of Android Studio, the build.gradle (Project) file is changed. In order to be able to use Google Services, you have ...
You will find your classpath from <https://console.firebase.google.com/> **You will find something like this in the firebase**(if you already got your **classpath** then you can ignore this section) ``` buildscript { repositories { // Make sure that you have the following two repositories google() // Googl...
51,039,271
<https://github.com/ITCoders/Human-detection-and-Tracking/blob/master/main.py> This is the code I obtained for the human detection. I'm using anaconda navigator(jupyter notebook). How can I use argument parser in this? How can I give the video path *-v* ? Can anyone please say me a solution for this? As the running of ...
2018/06/26
[ "https://Stackoverflow.com/questions/51039271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9993397/" ]
What you are asking seems similar to: [Passing command line arguments to argv in jupyter/ipython notebook](https://stackoverflow.com/questions/37534440/passing-command-line-arguments-to-argv-in-jupyter-ipython-notebook) There are two different methods mentioned in the post that were helpful. That said, I would sugges...
I tried out the answers listed on "[Passing command line arguments to argv in jupyter/ipython notebook](https://stackoverflow.com/questions/37534440/passing-command-line-arguments-to-argv-in-jupyter-ipython-notebook)", and came up with a different solution. My original code was ``` ap = argparse.ArgumentParser() ap.a...
51,039,271
<https://github.com/ITCoders/Human-detection-and-Tracking/blob/master/main.py> This is the code I obtained for the human detection. I'm using anaconda navigator(jupyter notebook). How can I use argument parser in this? How can I give the video path *-v* ? Can anyone please say me a solution for this? As the running of ...
2018/06/26
[ "https://Stackoverflow.com/questions/51039271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9993397/" ]
**All for me to do was pass an empty string to parser.parse\_args()** `parser.parse_args() > parser.parse_args("")` **And that was all for me.**
I tried out the answers listed on "[Passing command line arguments to argv in jupyter/ipython notebook](https://stackoverflow.com/questions/37534440/passing-command-line-arguments-to-argv-in-jupyter-ipython-notebook)", and came up with a different solution. My original code was ``` ap = argparse.ArgumentParser() ap.a...
72,879,863
yolov5 is detecting perfect while I run detect.py but unfortunately with deepsort track.py is not tracking even not detecting with tracker. how to set parameter my tracker ? --- yolov5: ``` >> python detect.py --source video.mp4 --weights best.pt ``` yolov5+deepsort: ``` >> python track.py --yolo-weights best.pt...
2022/07/06
[ "https://Stackoverflow.com/questions/72879863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14141667/" ]
DISCLAIMER: I am the creator of <https://github.com/mikel-brostrom/Yolov5_StrongSORT_OSNet> First of all: Does Yolov5+StrongSORT+OSNet run correctly without you custom modifications? Secondly: Have you checked that you are loading the same weights for Yolov5 and Yolov5+StrongSORT+OSNet? Moreover: Why all the cust...
I am also using the same model and was facing the same issue. Try annotating more image and increase the image size to 1024. Also make sure to use the best weights of yolov5 in yolov5+deepsort.
66,877,531
I have the following arguments which are to be parsed using argparse * input\_dir (string: Mandatory) * output\_dir (string: Mandatory) * file\_path (string: Mandatory) * supported\_file\_extensions (comma separated string - Optional) * ignore\_tests (boolean - Optional) If either comma separated string and a string ...
2021/03/30
[ "https://Stackoverflow.com/questions/66877531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7717431/" ]
The column `type` is ambiguous because it appears in both `t1` and in your JSON\_TABLE result. You should qualify the column. ``` mysql> select distinct t.type from t1, json_table(type, '$[*]' columns (type varchar(50) PATH '$')) as t order by t.type; +-------+ | type | +-------+ | type1 | | type2 | |...
I am able to resolve it by writing a `CROSS JOIN` ``` SELECT distinct j.type FROM t1 CROSS JOIN JSON_TABLE(t1.type, " $ [*]" COLUMNS ( type VARCHAR(20) PATH '$' ) ) j ```
8,456,516
How can I go about "selecting" on multiple [`queue.Queue`](http://docs.python.org/py3k/library/queue.html)'s simultaneously? Golang has the [desired feature](http://golang.org/doc/go_spec.html#Select_statements) with its channels: ``` select { case i1 = <-c1: print("received ", i1, " from c1\n") case c2 <- i2: ...
2011/12/10
[ "https://Stackoverflow.com/questions/8456516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/149482/" ]
There are many different implementations of producer-consumer queues, like [queue.Queue](http://docs.python.org/py3k/library/queue.html) available. They normally differ in a lot of properties like listed on this [excellent article](http://www.1024cores.net/home/lock-free-algorithms/queues) by Dmitry Vyukov. As you can ...
If you use `queue.PriorityQueue` you can get a similar behaviour using the channel objects as priorities: ``` import threading, logging import random, string, time from queue import PriorityQueue, Empty from contextlib import contextmanager logging.basicConfig(level=logging.NOTSET, format="%(threa...
8,456,516
How can I go about "selecting" on multiple [`queue.Queue`](http://docs.python.org/py3k/library/queue.html)'s simultaneously? Golang has the [desired feature](http://golang.org/doc/go_spec.html#Select_statements) with its channels: ``` select { case i1 = <-c1: print("received ", i1, " from c1\n") case c2 <- i2: ...
2011/12/10
[ "https://Stackoverflow.com/questions/8456516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/149482/" ]
If you use `queue.PriorityQueue` you can get a similar behaviour using the channel objects as priorities: ``` import threading, logging import random, string, time from queue import PriorityQueue, Empty from contextlib import contextmanager logging.basicConfig(level=logging.NOTSET, format="%(threa...
``` from queue import Queue # these imports needed for example code from threading import Thread from time import sleep from random import randint class MultiQueue(Queue): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.queues = [] def addQueue(self, queue): ...
8,456,516
How can I go about "selecting" on multiple [`queue.Queue`](http://docs.python.org/py3k/library/queue.html)'s simultaneously? Golang has the [desired feature](http://golang.org/doc/go_spec.html#Select_statements) with its channels: ``` select { case i1 = <-c1: print("received ", i1, " from c1\n") case c2 <- i2: ...
2011/12/10
[ "https://Stackoverflow.com/questions/8456516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/149482/" ]
There are many different implementations of producer-consumer queues, like [queue.Queue](http://docs.python.org/py3k/library/queue.html) available. They normally differ in a lot of properties like listed on this [excellent article](http://www.1024cores.net/home/lock-free-algorithms/queues) by Dmitry Vyukov. As you can ...
``` from queue import Queue # these imports needed for example code from threading import Thread from time import sleep from random import randint class MultiQueue(Queue): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.queues = [] def addQueue(self, queue): ...
8,456,516
How can I go about "selecting" on multiple [`queue.Queue`](http://docs.python.org/py3k/library/queue.html)'s simultaneously? Golang has the [desired feature](http://golang.org/doc/go_spec.html#Select_statements) with its channels: ``` select { case i1 = <-c1: print("received ", i1, " from c1\n") case c2 <- i2: ...
2011/12/10
[ "https://Stackoverflow.com/questions/8456516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/149482/" ]
There are many different implementations of producer-consumer queues, like [queue.Queue](http://docs.python.org/py3k/library/queue.html) available. They normally differ in a lot of properties like listed on this [excellent article](http://www.1024cores.net/home/lock-free-algorithms/queues) by Dmitry Vyukov. As you can ...
The [pychan](https://github.com/stuglaser/pychan) project duplicates Go channels in Python, including multiplexing. It implements the same algorithm as Go, so it meets all of your desired properties: * Multiple producers and consumers can communicate through a Chan. When both a producer and consumer are ready, the pai...
8,456,516
How can I go about "selecting" on multiple [`queue.Queue`](http://docs.python.org/py3k/library/queue.html)'s simultaneously? Golang has the [desired feature](http://golang.org/doc/go_spec.html#Select_statements) with its channels: ``` select { case i1 = <-c1: print("received ", i1, " from c1\n") case c2 <- i2: ...
2011/12/10
[ "https://Stackoverflow.com/questions/8456516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/149482/" ]
The [pychan](https://github.com/stuglaser/pychan) project duplicates Go channels in Python, including multiplexing. It implements the same algorithm as Go, so it meets all of your desired properties: * Multiple producers and consumers can communicate through a Chan. When both a producer and consumer are ready, the pai...
``` from queue import Queue # these imports needed for example code from threading import Thread from time import sleep from random import randint class MultiQueue(Queue): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.queues = [] def addQueue(self, queue): ...
38,272,965
It seems win32api should be able to do this given the answer [here](http://VBComponents.Remove) and [. I would like to remove all modules from an excel workbook (.xls) using python
2016/07/08
[ "https://Stackoverflow.com/questions/38272965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/360826/" ]
Consider using the [VBComponents collection](https://msdn.microsoft.com/en-us/library/aa443983(v=vs.60).aspx) available in the COM interface accessible with Python's `win23com.client` module. However, inside the particular workbook you need to first grant [programmatic access to the VBA object library](https://stackove...
Actually simply reading in the file with [`xlrd`](https://pypi.python.org/pypi/xlrd), copying with [`xlutils`](https://pypi.python.org/pypi/xlutils), and spitting it out with [`xlwt`](https://pypi.python.org/pypi/xlwt) will remove the VBA (and other stuff): ``` import xlrd, xlwt from xlutils.copy import copy as xl_cop...
8,923,764
``` #!/bin/python from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice import time import commands import sys import string import random device = MonkeyRunner.waitForConnection(10) device.press('KEYCODE_BACK', MonkeyDevice.DOWN_AND_UP) time.sleep(1) device.press('KEYCODE_BACK', MonkeyDevice.DOWN_AND_UP) ...
2012/01/19
[ "https://Stackoverflow.com/questions/8923764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/706780/" ]
Not all namespaces have corresponding DLL file names used in the Add Reference dialog. System.Windows is one of these. For example, `System.Windows.Clipboard` is resident in the PresentationCore.dll, but `System.Windows.SizeConverter` is in WindowsBase.dll. It all depends on the actual types you need to access.
System.Windows is the WPF base classes - you cant add that assembly to an ASP.NET site. You will need to change your application type to use it.
55,930,785
I am trying to understand NumPy `np.fromfunction()`. following piece of code is extracted from this [post](https://stackoverflow.com/a/55929789/11074017). ``` dist = np.array([ 1, -1]) f = lambda x: np.linalg.norm(x, 1) f(dist) ``` the output ``` 2.0 ``` is as expected. when I put them together to use np.linalg...
2019/05/01
[ "https://Stackoverflow.com/questions/55930785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Look at the error: ``` In [171]: np.fromfunction(f, ds.shape) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-171-1a3ed1ade41a> in <module> ----> 1 np.fr...
As you are using a 2 dimensional array, your function needs to take 2 inputs. The docs of `np.fromfunction()` <https://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfunction.html> say "Construct an array by executing a function over each coordinate." So it will pass the coordinates of each element of the arr...
31,965,153
I'm actually trying to program a sort of "rolegame", and actually I'm stuck in the process of creating the new Character files. I'm actually trying to make it so, if I call a character file, the system checks if it exists and, if not, it will create it. This is the code, just trying if it will create an empty file call...
2015/08/12
[ "https://Stackoverflow.com/questions/31965153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5219236/" ]
This is a cordova bug - <https://issues.apache.org/jira/browse/CB-5398>. You can change your path like this. ``` function uploadPhoto(imageURI) { //alert(imageURI); return false; //alert(imageURI); if (imageURI.substring(0,21)=="content://com.android") { photo_...
You can specify `encodingType: Camera.EncodingType.JPEG` and render image in your success callback like this- `$('#yourElement).attr('src', "data:image/jpeg;base64," + ImageData);` ``` navigator.camera.getPicture(onSuccess, onFail, { quality: 100, destinationType: Camera.DestinationType.DATA_URL, sourceTyp...
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
Use `tf.keras.optimizers.Adam(learning_rate)` instead of `keras.optimizers.Adam(learning_rate)`
I think you are using Keras directly. Instead of giving as from keras.distribute import —> give as from tensorflow.keras.distribute import Hope this would help you.. It is working for me.
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
As per the [documentation](https://keras.io/api/optimizers/) , try to import `keras` into your code like this, ``` >>> from tensorflow import keras ``` This has helped me as well.
I think you are using Keras directly. Instead of giving as from keras.distribute import —> give as from tensorflow.keras.distribute import Hope this would help you.. It is working for me.
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
Make sure you've imported tensorflow: ``` import tensorflow as tf ``` Then use ``` tf.optimizers.Adam(learning_rate) ```
I think you are using Keras directly. Instead of giving as from keras.distribute import —> give as from tensorflow.keras.distribute import Hope this would help you.. It is working for me.
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
There are ways to solve your problem as you are using keras 2.6 and tensorflow too: * use (from keras.optimizer\_v2.adam import Adam as Adam) but go through the function documentation once to specify your learning rate and beta values * you can also use (Adam = keras.optimizers.Adam). * (import tensorflow as tf) then ...
I think you are using Keras directly. Instead of giving as from keras.distribute import —> give as from tensorflow.keras.distribute import Hope this would help you.. It is working for me.
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
Use `tf.keras.optimizers.Adam(learning_rate)` instead of `keras.optimizers.Adam(learning_rate)`
As per the [documentation](https://keras.io/api/optimizers/) , try to import `keras` into your code like this, ``` >>> from tensorflow import keras ``` This has helped me as well.
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
Use `tf.keras.optimizers.Adam(learning_rate)` instead of `keras.optimizers.Adam(learning_rate)`
Make sure you've imported tensorflow: ``` import tensorflow as tf ``` Then use ``` tf.optimizers.Adam(learning_rate) ```