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 |
|---|---|---|---|---|---|
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | I would recommend [EasyInstall](http://pypi.python.org/pypi/setuptools#windows), a package management application for Python.
Once you've installed EasyInstall, you should be able to go to a command window and type:
```
easy_install simplejson
```
This may require putting easy\_install.exe on your PATH first, I don... | Download the source code, unzip it to and directory, and execute python setup.py install. |
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | I would recommend [EasyInstall](http://pypi.python.org/pypi/setuptools#windows), a package management application for Python.
Once you've installed EasyInstall, you should be able to go to a command window and type:
```
easy_install simplejson
```
This may require putting easy\_install.exe on your PATH first, I don... | You can import json as simplejson like this:
```
import json as simplejson
```
and keep backward compatibility. |
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | I would recommend [EasyInstall](http://pypi.python.org/pypi/setuptools#windows), a package management application for Python.
Once you've installed EasyInstall, you should be able to go to a command window and type:
```
easy_install simplejson
```
This may require putting easy\_install.exe on your PATH first, I don... | Really simple way is:
```
pip install simplejson
``` |
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | If you have Python 2.6 installed then you already have simplejson - just import `json`; it's the same thing. | Download the source code, unzip it to and directory, and execute python setup.py install. |
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | If you have Python 2.6 installed then you already have simplejson - just import `json`; it's the same thing. | You can import json as simplejson like this:
```
import json as simplejson
```
and keep backward compatibility. |
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | Really simple way is:
```
pip install simplejson
``` | If you have Python 2.6 installed then you already have simplejson - just import `json`; it's the same thing. |
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | You can import json as simplejson like this:
```
import json as simplejson
```
and keep backward compatibility. | Download the source code, unzip it to and directory, and execute python setup.py install. |
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | Really simple way is:
```
pip install simplejson
``` | Download the source code, unzip it to and directory, and execute python setup.py install. |
718,040 | <http://pypi.python.org/pypi/simplejson>
I am just diving into the Python world and want to make a simple twitter application which requires the installation of simplejson but not sure how I can set it up and get it working..
I am on a Windows System | 2009/04/04 | [
"https://Stackoverflow.com/questions/718040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] | Really simple way is:
```
pip install simplejson
``` | You can import json as simplejson like this:
```
import json as simplejson
```
and keep backward compatibility. |
16,330,838 | I would like to split a string by ':' and ' ' characters. However, i would like to ignore two spaces ' ' and two colons '::'. for e.g.
```
text = "s:11011 i:11010 ::110011 :110010 d:11000"
```
should split into
```
[s,11011,i,11010,:,110011, ,110010,d,11000]
```
after following the Regular Expressions HOWTO on t... | 2013/05/02 | [
"https://Stackoverflow.com/questions/16330838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1753000/"
] | Note this assumes that your data has format like `X:101010`:
```
>>> re.findall(r'(.+?):(.+?)\b ?',text)
[('s', '11011'), ('i', '11010'), (':', '110011'), (' ', '110010'), ('d', '11000')]
```
Then `chain` them up:
```
>>> list(itertools.chain(*_))
['s', '11011', 'i', '11010', ':', '110011', ' ', '110010', 'd', '110... | ```
>>> text = "s:11011 i:11010 ::110011 :110010 d:11000"
>>> [x for x in re.split(r":(:)?|\s(\s)?", text) if x]
['s', '11011', 'i', '11010', ':', '110011', ' ', '110010', 'd', '11000']
``` |
16,330,838 | I would like to split a string by ':' and ' ' characters. However, i would like to ignore two spaces ' ' and two colons '::'. for e.g.
```
text = "s:11011 i:11010 ::110011 :110010 d:11000"
```
should split into
```
[s,11011,i,11010,:,110011, ,110010,d,11000]
```
after following the Regular Expressions HOWTO on t... | 2013/05/02 | [
"https://Stackoverflow.com/questions/16330838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1753000/"
] | Note this assumes that your data has format like `X:101010`:
```
>>> re.findall(r'(.+?):(.+?)\b ?',text)
[('s', '11011'), ('i', '11010'), (':', '110011'), (' ', '110010'), ('d', '11000')]
```
Then `chain` them up:
```
>>> list(itertools.chain(*_))
['s', '11011', 'i', '11010', ':', '110011', ' ', '110010', 'd', '110... | Use the regex `(?<=\d) |:(?=\d)` to split:
```
>>> text = "s:11011 i:11010 ::110011 :110010 d:11000"
>>> result = re.split(r"(?<=\d) |:(?=\d)", text)
>>> result
['s', '11011', 'i', '11010', ':', '110011', ' ', '110010', 'd', '11000']
```
This will split on:
`(?<=\d)` a space, when there is a digit on the left. To ... |
16,330,838 | I would like to split a string by ':' and ' ' characters. However, i would like to ignore two spaces ' ' and two colons '::'. for e.g.
```
text = "s:11011 i:11010 ::110011 :110010 d:11000"
```
should split into
```
[s,11011,i,11010,:,110011, ,110010,d,11000]
```
after following the Regular Expressions HOWTO on t... | 2013/05/02 | [
"https://Stackoverflow.com/questions/16330838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1753000/"
] | Note this assumes that your data has format like `X:101010`:
```
>>> re.findall(r'(.+?):(.+?)\b ?',text)
[('s', '11011'), ('i', '11010'), (':', '110011'), (' ', '110010'), ('d', '11000')]
```
Then `chain` them up:
```
>>> list(itertools.chain(*_))
['s', '11011', 'i', '11010', ':', '110011', ' ', '110010', 'd', '110... | Have a look at this pattern:
```
([a-z\:\s])\:(\d+)
```
It will give you the same array you are expecting. No need to use split, just access the matches you have returned by the regex engine.
Hope it helps! |
16,330,838 | I would like to split a string by ':' and ' ' characters. However, i would like to ignore two spaces ' ' and two colons '::'. for e.g.
```
text = "s:11011 i:11010 ::110011 :110010 d:11000"
```
should split into
```
[s,11011,i,11010,:,110011, ,110010,d,11000]
```
after following the Regular Expressions HOWTO on t... | 2013/05/02 | [
"https://Stackoverflow.com/questions/16330838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1753000/"
] | ```
>>> text = "s:11011 i:11010 ::110011 :110010 d:11000"
>>> [x for x in re.split(r":(:)?|\s(\s)?", text) if x]
['s', '11011', 'i', '11010', ':', '110011', ' ', '110010', 'd', '11000']
``` | Have a look at this pattern:
```
([a-z\:\s])\:(\d+)
```
It will give you the same array you are expecting. No need to use split, just access the matches you have returned by the regex engine.
Hope it helps! |
16,330,838 | I would like to split a string by ':' and ' ' characters. However, i would like to ignore two spaces ' ' and two colons '::'. for e.g.
```
text = "s:11011 i:11010 ::110011 :110010 d:11000"
```
should split into
```
[s,11011,i,11010,:,110011, ,110010,d,11000]
```
after following the Regular Expressions HOWTO on t... | 2013/05/02 | [
"https://Stackoverflow.com/questions/16330838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1753000/"
] | Use the regex `(?<=\d) |:(?=\d)` to split:
```
>>> text = "s:11011 i:11010 ::110011 :110010 d:11000"
>>> result = re.split(r"(?<=\d) |:(?=\d)", text)
>>> result
['s', '11011', 'i', '11010', ':', '110011', ' ', '110010', 'd', '11000']
```
This will split on:
`(?<=\d)` a space, when there is a digit on the left. To ... | Have a look at this pattern:
```
([a-z\:\s])\:(\d+)
```
It will give you the same array you are expecting. No need to use split, just access the matches you have returned by the regex engine.
Hope it helps! |
65,856,151 | I am using anaconda and python 3.8. Now some of my codes need to be run with python 2. so I create a separate python 2.7 environment in conda like below:
after that, I installed spyder, then launcher spyder amd spyder is showing I am still using python 3.8
how do i do to use python 2.7 in spyder with a new environmen... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65856151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9983652/"
] | According to the documentation [here](https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/), this should create a python2.7 virtual environment (29 April 2021) with spyder installed. I verified that spyder version 3.3.6 is python2.7 compatible
```
conda create -y -n py27 python=2.7 spyder=3.3.6
```... | You can manage environments from Ananconda's Navigator. <https://docs.anaconda.com/anaconda/navigator/getting-started/#navigator-managing-environments> |
65,856,151 | I am using anaconda and python 3.8. Now some of my codes need to be run with python 2. so I create a separate python 2.7 environment in conda like below:
after that, I installed spyder, then launcher spyder amd spyder is showing I am still using python 3.8
how do i do to use python 2.7 in spyder with a new environmen... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65856151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9983652/"
] | I suggest to first search for an anaconda 2.7 version you want, then install it explicitly, this will make resolving much faster, give you a "stable" anaconda and allow you more control while installing all anaconda packages:
First:
```
conda search anaconda
```
Then select a version that has 27, in my case:
```
#... | You can manage environments from Ananconda's Navigator. <https://docs.anaconda.com/anaconda/navigator/getting-started/#navigator-managing-environments> |
65,856,151 | I am using anaconda and python 3.8. Now some of my codes need to be run with python 2. so I create a separate python 2.7 environment in conda like below:
after that, I installed spyder, then launcher spyder amd spyder is showing I am still using python 3.8
how do i do to use python 2.7 in spyder with a new environmen... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65856151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9983652/"
] | According to the documentation [here](https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/), this should create a python2.7 virtual environment (29 April 2021) with spyder installed. I verified that spyder version 3.3.6 is python2.7 compatible
```
conda create -y -n py27 python=2.7 spyder=3.3.6
```... | **I guess you are on previous pip;**
1. Use `which pip` command to find out your current pip environment.
2. Modify your **.bash** file and set another new environment variable for your new pip.
3. Source your **.bash** file.
4. Try to install **spyder** by using new pip env variable; something like `pipX install spyd... |
65,856,151 | I am using anaconda and python 3.8. Now some of my codes need to be run with python 2. so I create a separate python 2.7 environment in conda like below:
after that, I installed spyder, then launcher spyder amd spyder is showing I am still using python 3.8
how do i do to use python 2.7 in spyder with a new environmen... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65856151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9983652/"
] | I suggest to first search for an anaconda 2.7 version you want, then install it explicitly, this will make resolving much faster, give you a "stable" anaconda and allow you more control while installing all anaconda packages:
First:
```
conda search anaconda
```
Then select a version that has 27, in my case:
```
#... | **I guess you are on previous pip;**
1. Use `which pip` command to find out your current pip environment.
2. Modify your **.bash** file and set another new environment variable for your new pip.
3. Source your **.bash** file.
4. Try to install **spyder** by using new pip env variable; something like `pipX install spyd... |
65,856,151 | I am using anaconda and python 3.8. Now some of my codes need to be run with python 2. so I create a separate python 2.7 environment in conda like below:
after that, I installed spyder, then launcher spyder amd spyder is showing I am still using python 3.8
how do i do to use python 2.7 in spyder with a new environmen... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65856151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9983652/"
] | According to the documentation [here](https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/), this should create a python2.7 virtual environment (29 April 2021) with spyder installed. I verified that spyder version 3.3.6 is python2.7 compatible
```
conda create -y -n py27 python=2.7 spyder=3.3.6
```... | I suggest to first search for an anaconda 2.7 version you want, then install it explicitly, this will make resolving much faster, give you a "stable" anaconda and allow you more control while installing all anaconda packages:
First:
```
conda search anaconda
```
Then select a version that has 27, in my case:
```
#... |
8,638,880 | I've come across an interesting behavior with Python 3 that I don't understand. I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the `is` operator. However, w... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206349/"
] | >
> I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the is operator.
>
>
>
This is your misconception: concerning the `int`s and `long`s, that is valid ... | This is a properly behavior.
```
x == y #True because they have a the same value
x is y #False because x isn't reference to y
id(x) == id(y) #False because as the above
```
But:
```
x = input()
y = x #rewrite reference of x to another variable
y == x and x is y and id(x) == id(y) #True
``` |
8,638,880 | I've come across an interesting behavior with Python 3 that I don't understand. I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the `is` operator. However, w... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206349/"
] | This is a properly behavior.
```
x == y #True because they have a the same value
x is y #False because x isn't reference to y
id(x) == id(y) #False because as the above
```
But:
```
x = input()
y = x #rewrite reference of x to another variable
y == x and x is y and id(x) == id(y) #True
``` | Values that are the same are **not** guaranteed to be the same instance. That's merely an optimization that you can't rely on. There aren't very many times that using `is` is appropriate, use `==` instead. |
8,638,880 | I've come across an interesting behavior with Python 3 that I don't understand. I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the `is` operator. However, w... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206349/"
] | This is a properly behavior.
```
x == y #True because they have a the same value
x is y #False because x isn't reference to y
id(x) == id(y) #False because as the above
```
But:
```
x = input()
y = x #rewrite reference of x to another variable
y == x and x is y and id(x) == id(y) #True
``` | >
> I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object
>
>
>
No, that is not guaranteed, in the same way that if I speak of an orange that is physically indistinguishable from the ... |
8,638,880 | I've come across an interesting behavior with Python 3 that I don't understand. I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the `is` operator. However, w... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206349/"
] | >
> I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the is operator.
>
>
>
This is your misconception: concerning the `int`s and `long`s, that is valid ... | Values that are the same are **not** guaranteed to be the same instance. That's merely an optimization that you can't rely on. There aren't very many times that using `is` is appropriate, use `==` instead. |
8,638,880 | I've come across an interesting behavior with Python 3 that I don't understand. I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the `is` operator. However, w... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206349/"
] | >
> I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the is operator.
>
>
>
This is your misconception: concerning the `int`s and `long`s, that is valid ... | This is because of an implementation detail - you can't rely on `is` returning `True` in general. Try this script:
```
x = 'test'
y = 'test'
print('%r: \'x == y\' is %s, \'x is y\' is %s' % (x, x == y, x is y))
x = 'testtest'
y = 'testtest'
print('%r: \'x == y\' is %s, \'x is y\' is %s' % (x, x == y, x is y))
for i in... |
8,638,880 | I've come across an interesting behavior with Python 3 that I don't understand. I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the `is` operator. However, w... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206349/"
] | >
> I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the is operator.
>
>
>
This is your misconception: concerning the `int`s and `long`s, that is valid ... | >
> I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object
>
>
>
No, that is not guaranteed, in the same way that if I speak of an orange that is physically indistinguishable from the ... |
8,638,880 | I've come across an interesting behavior with Python 3 that I don't understand. I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the `is` operator. However, w... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206349/"
] | This is because of an implementation detail - you can't rely on `is` returning `True` in general. Try this script:
```
x = 'test'
y = 'test'
print('%r: \'x == y\' is %s, \'x is y\' is %s' % (x, x == y, x is y))
x = 'testtest'
y = 'testtest'
print('%r: \'x == y\' is %s, \'x is y\' is %s' % (x, x == y, x is y))
for i in... | Values that are the same are **not** guaranteed to be the same instance. That's merely an optimization that you can't rely on. There aren't very many times that using `is` is appropriate, use `==` instead. |
8,638,880 | I've come across an interesting behavior with Python 3 that I don't understand. I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object, which allows the use of the `is` operator. However, w... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/206349/"
] | This is because of an implementation detail - you can't rely on `is` returning `True` in general. Try this script:
```
x = 'test'
y = 'test'
print('%r: \'x == y\' is %s, \'x is y\' is %s' % (x, x == y, x is y))
x = 'testtest'
y = 'testtest'
print('%r: \'x == y\' is %s, \'x is y\' is %s' % (x, x == y, x is y))
for i in... | >
> I've understood that with the built-in immutable types like str, int, etc, that not only are two variables of the same value (both contain 'x') equal, they are literally the same object
>
>
>
No, that is not guaranteed, in the same way that if I speak of an orange that is physically indistinguishable from the ... |
9,887,224 | Does apache or nginx must be installed before I can run my PHP files in browser?
Django itself has a run-server for testing python codes.Is there any similar way to test PHP files? | 2012/03/27 | [
"https://Stackoverflow.com/questions/9887224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1188895/"
] | Your options is:
* Install web server, as you said.
* Use [web server](http://php.net/manual/en/features.commandline.webserver.php), as JohnP suggested.
* Install php-cli, run your script from console, save output to html file and open it in a browser.
Actually, you can't normally "run" php files in browser. Browser ... | Yes. You need something like nginx or Apache. Either install one of those (on say your local machine). **OR**, see JohnP's comment - a new feature released recently. |
9,887,224 | Does apache or nginx must be installed before I can run my PHP files in browser?
Django itself has a run-server for testing python codes.Is there any similar way to test PHP files? | 2012/03/27 | [
"https://Stackoverflow.com/questions/9887224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1188895/"
] | There is a [built in web server](http://php.net/manual/en/features.commandline.webserver.php) from php 5.4.
Before PHP 5.4 you must install a web server to execute php files in browser | Yes. You need something like nginx or Apache. Either install one of those (on say your local machine). **OR**, see JohnP's comment - a new feature released recently. |
2,765,664 | I have got some code to pass in a variable into a script from the command line. I can pass any value into `function` for the `var` arg. The problem is that when I put `function` into a class the variable doesn't get read into `function`. The script is:
```
import sys, os
def function(var):
print var
class functi... | 2010/05/04 | [
"https://Stackoverflow.com/questions/2765664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234435/"
] | you might find [`getattr`](http://docs.python.org/library/functions.html#getattr) useful:
```
>>> argv = ['function.py', 'run', 'Hello']
>>> class A:
def run(self, *args):
print(*args)
>>> getattr(A(), argv[1])(*argv[2:])
Hello
``` | It sounds like rather than:
```
self.function = self.module.__dict__[self.functionName]
```
you want to do something like (as @SilentGhost mentioned):
```
self.function = getattr(some_class, self.functionName)
```
The tricky thing with retrieving a method on a class (not an object instance) is that you are going ... |
65,661,996 | How Do I pass values say `12,32,34` to formula `x+y+z` in python without assigning manually?
I have tried using `**args` but the results is `None`.
```
def myFormula(*args):
lambda x, y: x+y+z(*args)
print(myFormula(1,2,3))
``` | 2021/01/11 | [
"https://Stackoverflow.com/questions/65661996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14911024/"
] | try this:
```py
formula = lambda x,y,z: x+y+z
print(formula(1,2,3))
```
there is no need to use \*args there.
here is an example of using a function for a formula
```py
# a = (v - u)/t
acceleration = lambda v, u, t: (v - u)/t
print(acceleration(23, 12, 5)
``` | Just use `sum`:
```
print(sum([1, 2, 3]))
```
Output:
```
6
```
If you want a `def` try this:
```
def myFormula(*args):
return sum(args)
print(myFormula(1, 2, 3))
```
Output:
```
6
``` |
65,661,996 | How Do I pass values say `12,32,34` to formula `x+y+z` in python without assigning manually?
I have tried using `**args` but the results is `None`.
```
def myFormula(*args):
lambda x, y: x+y+z(*args)
print(myFormula(1,2,3))
``` | 2021/01/11 | [
"https://Stackoverflow.com/questions/65661996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14911024/"
] | try this:
```py
formula = lambda x,y,z: x+y+z
print(formula(1,2,3))
```
there is no need to use \*args there.
here is an example of using a function for a formula
```py
# a = (v - u)/t
acceleration = lambda v, u, t: (v - u)/t
print(acceleration(23, 12, 5)
``` | A regular function doesn't require doing any manual assignments:
```
def myFormula(x,y,z):
return sum((x,y,z))
print(myFormula(1,2,3))
```
You can handle an arbitrary number of arguments in this situation like this:
```
def myFormula(*args):
return sum(args)
print(myFormula(1,2,3,4))
``` |
65,661,996 | How Do I pass values say `12,32,34` to formula `x+y+z` in python without assigning manually?
I have tried using `**args` but the results is `None`.
```
def myFormula(*args):
lambda x, y: x+y+z(*args)
print(myFormula(1,2,3))
``` | 2021/01/11 | [
"https://Stackoverflow.com/questions/65661996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14911024/"
] | A regular function doesn't require doing any manual assignments:
```
def myFormula(x,y,z):
return sum((x,y,z))
print(myFormula(1,2,3))
```
You can handle an arbitrary number of arguments in this situation like this:
```
def myFormula(*args):
return sum(args)
print(myFormula(1,2,3,4))
``` | Just use `sum`:
```
print(sum([1, 2, 3]))
```
Output:
```
6
```
If you want a `def` try this:
```
def myFormula(*args):
return sum(args)
print(myFormula(1, 2, 3))
```
Output:
```
6
``` |
55,929,577 | I'm trying to run a python program in the online IDE SourceLair. I've written a line of code that simply prints hello, but I am embarrassed to say I can't figure out how to RUN the program.
I have the console, web server, and terminal available on the IDE already pulled up. I just don't know how to start the program.... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55929577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11434891/"
] | Can I ask you why you are using SourceLair?
Well I just figured it out in about 2 mins....its the same as using any other editor for python.
All you have to do is to run it in the terminal. python (nameoffile).py | Antonis from SourceLair here.
In SourceLair, you get a fully featured terminal, plus a web server for running your Python applications.
For simple files, as you correctly found out, all you have to do is save the file and run it through your terminal, using `python <your-file.py>`.
If you want to run a complete web ... |
60,099,737 | I have a compiled a dataframe that contains USGS streamflow data at several different streamgages. Now I want to create a Gantt chart similar to [this](https://stackoverflow.com/questions/31820578/how-to-plot-stacked-event-duration-gantt-charts-using-python-pandas). Currently, my data has columns as site names and a da... | 2020/02/06 | [
"https://Stackoverflow.com/questions/60099737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10382580/"
] | The reason this is happening is because you have pd.MultiIndex column headers. I can tell you have MultiIndex column headers by tuples in your column names from pd.DataFrame.info() results.
See this example below:
```
df = pd.DataFrame(np.random.randint(100,999,(5,5))) #create a dataframe
df.columns = pd.MultiIndex.... | Well, as @EdChum said above, .dt is a pd.DataFrame attribute, not a pd.Series method. If you want to get the date difference, use the `apply()` pd.Dataframe method. |
16,247,002 | I have a script using DaemonRunner to create a daemon process with a pid file. The problem is that if someone tried to start it without stopping the currently running process, it will silently fail. What's the best way to detect an existing process and alert the user to stop it first? Is it as easy as checking the pidf... | 2013/04/27 | [
"https://Stackoverflow.com/questions/16247002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/629195/"
] | since DaemonRunner handles its own lockfile, it's more wisely to refer to that one, to be sure you can't mess up. Maybe this block can help you with that:
Add
`from lockfile import LockTimeout`
to the beginning of the script and surround `daemon_runner.doaction()` like this
```
try:
daemon_runner.do_action... | This is the solution that I decided to use:
```
lockfile = runner.make_pidlockfile('/tmp/myapp.pid', 1)
if lockfile.is_locked():
print 'It looks like a daemon is already running!'
exit()
app = App()
daemon_runner = runner.DaemonRunner(app)
daemon_runner.do_action()
```
Is this a best practice or is there a ... |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | scriptfile should be a full path file name
try below
`monkeyrunner c:\test_script\first.py` | Under all unix/linux families OS the sha bang syntax can be used.
Edit the first line of your script with the results of the following command:
```
which monkeyrunner
```
for example, if monkeyrunner (usually provided with android sdk) has been installed under /usr/local/bin/sdk write:
```
#!/usr/local/bin/sdk/to... |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | scriptfile should be a full path file name
try below
`monkeyrunner c:\test_script\first.py` | I met the same things as you did, I resolved by using "monkeyrunner" command under tools, and your script file should be a full path name. It looks like the directory “tools” is the main directory of MonnkeyRunner. I am depressed that I can't run my script files by pydev IDE directly. |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | scriptfile should be a full path file name
try below
`monkeyrunner c:\test_script\first.py` | try using something like
```
...\tools>monkeyrunner -v ALL first.py
```
where `first.py` was my sample python script which I copied into tools folder of android SDK (the place where `monkeyrunner.bat` is located) |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | Under all unix/linux families OS the sha bang syntax can be used.
Edit the first line of your script with the results of the following command:
```
which monkeyrunner
```
for example, if monkeyrunner (usually provided with android sdk) has been installed under /usr/local/bin/sdk write:
```
#!/usr/local/bin/sdk/to... | monkeyrunner.bat `cygpath -w $(pwd)/monkey.py` |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | scriptfile should be a full path file name
try below
`monkeyrunner c:\test_script\first.py` | monkeyrunner.bat `cygpath -w $(pwd)/monkey.py` |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | try using something like
```
...\tools>monkeyrunner -v ALL first.py
```
where `first.py` was my sample python script which I copied into tools folder of android SDK (the place where `monkeyrunner.bat` is located) | It looks not make sense to switch working directory to Android SDK folder but just for obtain some relative references path for itself. It means you have to specify the full path for your script file and the PNG image files you want to save or compare to.
A better way is modify few lines in the "monkeyrunner.bat" unde... |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | Under all unix/linux families OS the sha bang syntax can be used.
Edit the first line of your script with the results of the following command:
```
which monkeyrunner
```
for example, if monkeyrunner (usually provided with android sdk) has been installed under /usr/local/bin/sdk write:
```
#!/usr/local/bin/sdk/to... | It looks not make sense to switch working directory to Android SDK folder but just for obtain some relative references path for itself. It means you have to specify the full path for your script file and the PNG image files you want to save or compare to.
A better way is modify few lines in the "monkeyrunner.bat" unde... |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | Under all unix/linux families OS the sha bang syntax can be used.
Edit the first line of your script with the results of the following command:
```
which monkeyrunner
```
for example, if monkeyrunner (usually provided with android sdk) has been installed under /usr/local/bin/sdk write:
```
#!/usr/local/bin/sdk/to... | I met the same things as you did, I resolved by using "monkeyrunner" command under tools, and your script file should be a full path name. It looks like the directory “tools” is the main directory of MonnkeyRunner. I am depressed that I can't run my script files by pydev IDE directly. |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | try using something like
```
...\tools>monkeyrunner -v ALL first.py
```
where `first.py` was my sample python script which I copied into tools folder of android SDK (the place where `monkeyrunner.bat` is located) | I met the same things as you did, I resolved by using "monkeyrunner" command under tools, and your script file should be a full path name. It looks like the directory “tools” is the main directory of MonnkeyRunner. I am depressed that I can't run my script files by pydev IDE directly. |
7,554,576 | i am tryig to execute a sample python program through monkey runner command prompt and it is throwing an error
```
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FIN... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7554576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/946040/"
] | scriptfile should be a full path file name
try below
`monkeyrunner c:\test_script\first.py` | It looks not make sense to switch working directory to Android SDK folder but just for obtain some relative references path for itself. It means you have to specify the full path for your script file and the PNG image files you want to save or compare to.
A better way is modify few lines in the "monkeyrunner.bat" unde... |
21,302,971 | I initially had `python 2.7.3` i downloaded from the sourcee and did `make install`
and after downloading i run `python`
but again my system is showing `2.7.3`
I didn't get any error while installing | 2014/01/23 | [
"https://Stackoverflow.com/questions/21302971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3113427/"
] | Since you are on Ubuntu, I recommend following the steps outlined [here](http://heliumhq.com/docs/installing_python_2.7.5_on_ubuntu) to install a new Python version. The steps there are for Python 2.7.5 but should be equally applicable to Python 2.7.6. | The version you installed is probably in /usr/local/bin/python . Try calling it with the complete path. You may want to change your path settings or remove the previously installed version using your package manager if it was installed by the system. |
59,987,601 | Good morning!
I am trying to remove duplicate rows from a csv file with panda.
I have 2 files, A.csv and B.csv
I want to delete all rows in A that exist in B.
File A.csv:
```
Pedro,10,rojo
Mirta,15,azul
Jose,5,violeta
```
File B.csv:
```
Pedro,
ignacio,
fernando,
federico,
```
Output file output.csv:
```
Mir... | 2020/01/30 | [
"https://Stackoverflow.com/questions/59987601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12814128/"
] | Search based on Many-to-Many Relationship
=========================================
Talking about articles and authors, when each article may have many authors, let's say you are going to search based on a `term` and find *Articles where the article name or article abstract contains the term or one of the authors of t... | You are doing a lot of things wrong :
1. you can not use `.ToString()` on classes or lists. so first you have to remove or change these lines. for example :
```cs
sort = sort.Where(s => OfficerIDs.ToString().Contains(searchString));
sort = sort.OrderBy(s => officerList.ToString()).ThenBy(s => s.EventDate);
s... |
3,870,312 | I am trying to solve problem related to model inheritance in Django. I have four relevant models: `Order`, `OrderItem` which has ForeignKey to `Order` and then there is `Orderable` model which is model inheritance superclass to children models like `Fee`, `RentedProduct` etc. In python, it goes like this (posting only ... | 2010/10/06 | [
"https://Stackoverflow.com/questions/3870312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/303184/"
] | Try inherit OrderItemInlineAdmin's Form a define your own Form there. But fingers crossed for that. | I'm looking for a solid answer to this very thing, but you should check out FeinCMS. They are doing this quite well.
See, for example, the FeinCMS [inline editor](https://github.com/matthiask/feincms/blob/master/feincms/admin/item_editor.py). I need to figure out how to adapt this to my code. |
34,910,115 | I'd like to make this more efficient but I can't figure out how to turn this into a python list comprehension.
```
coupons = []
for source in sources:
for coupon in source:
if coupon.code_used not in coupons:
coupons.append(coupon.code_used)
``` | 2016/01/20 | [
"https://Stackoverflow.com/questions/34910115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3977548/"
] | You cannot access the list you currently creating, but if the order is not important you can use a `set`:
```
coupons = set(coupon.code_used for source in sources for coupon in source)
``` | ```
used_codes = set(coupon.code_used for source in sources for coupon in source)
``` |
34,910,115 | I'd like to make this more efficient but I can't figure out how to turn this into a python list comprehension.
```
coupons = []
for source in sources:
for coupon in source:
if coupon.code_used not in coupons:
coupons.append(coupon.code_used)
``` | 2016/01/20 | [
"https://Stackoverflow.com/questions/34910115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3977548/"
] | ```
used_codes = set(coupon.code_used for source in sources for coupon in source)
``` | I'm going to assume that the order of the resulting list is unimportant, because then we can just use a set to eliminate duplicates.
```
coupons = list(set(coupon.code_used for source in sources for coupon in source))
```
This uses a generator expression, with the `for` clauses appearing in the same order as in the ... |
34,910,115 | I'd like to make this more efficient but I can't figure out how to turn this into a python list comprehension.
```
coupons = []
for source in sources:
for coupon in source:
if coupon.code_used not in coupons:
coupons.append(coupon.code_used)
``` | 2016/01/20 | [
"https://Stackoverflow.com/questions/34910115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3977548/"
] | ```
used_codes = set(coupon.code_used for source in sources for coupon in source)
``` | ```
coupons = {x for x in (y.code_used for y in coupon for coupon in sources)}
```
you are actually looking for a `set` |
34,910,115 | I'd like to make this more efficient but I can't figure out how to turn this into a python list comprehension.
```
coupons = []
for source in sources:
for coupon in source:
if coupon.code_used not in coupons:
coupons.append(coupon.code_used)
``` | 2016/01/20 | [
"https://Stackoverflow.com/questions/34910115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3977548/"
] | You cannot access the list you currently creating, but if the order is not important you can use a `set`:
```
coupons = set(coupon.code_used for source in sources for coupon in source)
``` | I'm going to assume that the order of the resulting list is unimportant, because then we can just use a set to eliminate duplicates.
```
coupons = list(set(coupon.code_used for source in sources for coupon in source))
```
This uses a generator expression, with the `for` clauses appearing in the same order as in the ... |
34,910,115 | I'd like to make this more efficient but I can't figure out how to turn this into a python list comprehension.
```
coupons = []
for source in sources:
for coupon in source:
if coupon.code_used not in coupons:
coupons.append(coupon.code_used)
``` | 2016/01/20 | [
"https://Stackoverflow.com/questions/34910115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3977548/"
] | You cannot access the list you currently creating, but if the order is not important you can use a `set`:
```
coupons = set(coupon.code_used for source in sources for coupon in source)
``` | ```
coupons = {x for x in (y.code_used for y in coupon for coupon in sources)}
```
you are actually looking for a `set` |
34,910,115 | I'd like to make this more efficient but I can't figure out how to turn this into a python list comprehension.
```
coupons = []
for source in sources:
for coupon in source:
if coupon.code_used not in coupons:
coupons.append(coupon.code_used)
``` | 2016/01/20 | [
"https://Stackoverflow.com/questions/34910115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3977548/"
] | I'm going to assume that the order of the resulting list is unimportant, because then we can just use a set to eliminate duplicates.
```
coupons = list(set(coupon.code_used for source in sources for coupon in source))
```
This uses a generator expression, with the `for` clauses appearing in the same order as in the ... | ```
coupons = {x for x in (y.code_used for y in coupon for coupon in sources)}
```
you are actually looking for a `set` |
40,674,526 | I'm having trouble deploying my app to heroku, I'm using the heroku\_deploy.sh from documentation and get
```
Deploying Heroku Version 82d8ec66d98120ae24c89b88dc75e4d1c225461e
Traceback (most recent call last):
File "<string>", line 1, in <module>
KeyError: 'source_blob'
Traceback (most recent call last):
File "<s... | 2016/11/18 | [
"https://Stackoverflow.com/questions/40674526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67505/"
] | If you want to destroy the window when its closed just specifiy
```
closeAction : 'destroy'
```
instead of
```
closeAction : 'hide'
```
If doing so ExtJS destroys, and thus removes, all items completely. Additional, if specifying `destroy` as close action you will not need the additional listener (`onCardLayoutWi... | ### Thanks to oberbics and Evan Trimboli
I solve the problem, just because I assign a rownumberer like this:
>
> new Ext.grid.RowNumberer({width: 40}),
>
>
>
however, when I replace it with xtype config, it works well.
>
> {xtype: 'rownumberer'}
>
>
>
```
Ext.define('MyWebServer.view.qualityassign.Allocate... |
5,445,166 | I am developing a 3d shooter game that I would like to run on Computers/Phones/Tablets and would like some help to choose which engine to use.
* I would like to write the application once and port it over to Android/iOS/windows/mac with ease.
* I would like to make the application streamable over the internet.
* The e... | 2011/03/26 | [
"https://Stackoverflow.com/questions/5445166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509895/"
] | You've mentioned iOS -- that pretty much limits you to going native or using web stack. Since native is not what you want (because that'd be different for each platform you mention), you can go JavaScript. The ideal thing for that would be WebGL, but support is still experimental and not available in phone systems. You... | Well I see you've checked Unity3D already, but I can't think of any other engines work on PC, Telephones and via streaming internet that suport 3D (for 2D check EXEN or any others).
I'm also pretty sure that you can use Unity code-based, and it supports a couple of different languages, but for Unity to work you can't... |
5,445,166 | I am developing a 3d shooter game that I would like to run on Computers/Phones/Tablets and would like some help to choose which engine to use.
* I would like to write the application once and port it over to Android/iOS/windows/mac with ease.
* I would like to make the application streamable over the internet.
* The e... | 2011/03/26 | [
"https://Stackoverflow.com/questions/5445166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509895/"
] | For the requirements that you have Unity3d is probably one of your best bets. As roy said there aren't any other 3D engines out there that will span that wide a range of platforms. Why do you think that going to a completely code based system would save you from creating a variety of classes with various responsibiliti... | Well I see you've checked Unity3D already, but I can't think of any other engines work on PC, Telephones and via streaming internet that suport 3D (for 2D check EXEN or any others).
I'm also pretty sure that you can use Unity code-based, and it supports a couple of different languages, but for Unity to work you can't... |
5,445,166 | I am developing a 3d shooter game that I would like to run on Computers/Phones/Tablets and would like some help to choose which engine to use.
* I would like to write the application once and port it over to Android/iOS/windows/mac with ease.
* I would like to make the application streamable over the internet.
* The e... | 2011/03/26 | [
"https://Stackoverflow.com/questions/5445166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/509895/"
] | For the requirements that you have Unity3d is probably one of your best bets. As roy said there aren't any other 3D engines out there that will span that wide a range of platforms. Why do you think that going to a completely code based system would save you from creating a variety of classes with various responsibiliti... | You've mentioned iOS -- that pretty much limits you to going native or using web stack. Since native is not what you want (because that'd be different for each platform you mention), you can go JavaScript. The ideal thing for that would be WebGL, but support is still experimental and not available in phone systems. You... |
34,755,636 | I am trying to show time series lines representing an effort amount using matplotlib and pandas.
I've got my DF's to all to overlay in one plot, however when I do python seems to strip the x axis of the date and input some numbers. (I'm not sure where these come from but at a guess, not all days contain the same data... | 2016/01/12 | [
"https://Stackoverflow.com/questions/34755636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3509416/"
] | When you use `getClass().getResource(...)` you are loading a resource, not specifying a path to a file. In the case where the class loader loads classes from the file system, these essentially equate to the same thing, and it does actually work (though even then there's no technical reason it has to). When the class lo... | A bit late but this can maybe help someone. If you are using IntelliJ, your `resources` folder may not be marked as THE resources folder, which has the following icon:
[](https://i.stack.imgur.com/LWBaw.png)
This is the way I fixed it:
[, quick and dirty [doctests](http://docs.python.org/2/library/doctest.html) for JavaScript and CoffeeScript. I'd like to make the library less dirty by using a JavaScript parser rather than regular expressions to locate comments.
I'd like to use [Esp... | 2013/02/06 | [
"https://Stackoverflow.com/questions/14722788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/312785/"
] | Most AST-producing parsers throw away comments. I don't know what Esprima or Acorn do, but that might be the issue.
.... in fact, Esprima lists comment capture as a current bug:
<http://code.google.com/p/esprima/issues/detail?id=197>
... Acorn's code is right there in GitHub. It appears to throw comments away, too.
... | You can already use Esprima to achieve what you want:
1. Parse the code, get the comments (as an array).
2. Iterate over the comments, see if each is what you are interested in.
3. If you need to transform the comment, note its range. Collect all transformations.
4. Apply the transformation back-to-first so that the r... |
48,548,878 | I'm running Django 1.11 with Python 3.4 on Ubuntu 14.04.5
Moving my development code to the test server and running into some strange errors. Can anyone see what is wrong from the traceback?
I'm very new to linux and have made the mistake of developing on a Windows machine on this first go around. I have since create... | 2018/01/31 | [
"https://Stackoverflow.com/questions/48548878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3541909/"
] | The issue is likely related to [this open bug](https://code.djangoproject.com/ticket/25012) in Django. You have some test data in one of the fields that you are now converting to a ForeignKey.
For instance, maybe `department` used to be a `CharField` and you added an employee who has "test" as their `department` value... | The simplest way that works for me is changing the foreign key to a character field, Make migrations, migrate. Then change back the field to be a foreign key. This way, you will force a database alteration which is very important |
48,548,878 | I'm running Django 1.11 with Python 3.4 on Ubuntu 14.04.5
Moving my development code to the test server and running into some strange errors. Can anyone see what is wrong from the traceback?
I'm very new to linux and have made the mistake of developing on a Windows machine on this first go around. I have since create... | 2018/01/31 | [
"https://Stackoverflow.com/questions/48548878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3541909/"
] | The issue is likely related to [this open bug](https://code.djangoproject.com/ticket/25012) in Django. You have some test data in one of the fields that you are now converting to a ForeignKey.
For instance, maybe `department` used to be a `CharField` and you added an employee who has "test" as their `department` value... | In my case @YPCrumble was correct and it was caused after I changed a field from a StreamField to a CharField.
The quickest solution I found was to open up my DB on a GUI (Postico in my case) and overwrite the values from JSON to the default value. This meant setting every existing fields values to 1, in my situation... |
48,548,878 | I'm running Django 1.11 with Python 3.4 on Ubuntu 14.04.5
Moving my development code to the test server and running into some strange errors. Can anyone see what is wrong from the traceback?
I'm very new to linux and have made the mistake of developing on a Windows machine on this first go around. I have since create... | 2018/01/31 | [
"https://Stackoverflow.com/questions/48548878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3541909/"
] | The issue is likely related to [this open bug](https://code.djangoproject.com/ticket/25012) in Django. You have some test data in one of the fields that you are now converting to a ForeignKey.
For instance, maybe `department` used to be a `CharField` and you added an employee who has "test" as their `department` value... | In my case, I have the same issue on the development. This command works for me.
```
python manage.py flush
```
Make sure it removes all data from the database. Run this command, it will delete all data from the database and run migration again.
```
python manage.py migrate
``` |
48,548,878 | I'm running Django 1.11 with Python 3.4 on Ubuntu 14.04.5
Moving my development code to the test server and running into some strange errors. Can anyone see what is wrong from the traceback?
I'm very new to linux and have made the mistake of developing on a Windows machine on this first go around. I have since create... | 2018/01/31 | [
"https://Stackoverflow.com/questions/48548878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3541909/"
] | The issue is likely related to [this open bug](https://code.djangoproject.com/ticket/25012) in Django. You have some test data in one of the fields that you are now converting to a ForeignKey.
For instance, maybe `department` used to be a `CharField` and you added an employee who has "test" as their `department` value... | In my case error was thith replace `IntegerField` to `TextField in file migartion
file migration:
```
# Generated by Django 3.1.3 on 2020-12-03 11:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminPanel', '0028_auto_20201203_1117'),
]
op... |
48,548,878 | I'm running Django 1.11 with Python 3.4 on Ubuntu 14.04.5
Moving my development code to the test server and running into some strange errors. Can anyone see what is wrong from the traceback?
I'm very new to linux and have made the mistake of developing on a Windows machine on this first go around. I have since create... | 2018/01/31 | [
"https://Stackoverflow.com/questions/48548878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3541909/"
] | In my case, I have the same issue on the development. This command works for me.
```
python manage.py flush
```
Make sure it removes all data from the database. Run this command, it will delete all data from the database and run migration again.
```
python manage.py migrate
``` | The simplest way that works for me is changing the foreign key to a character field, Make migrations, migrate. Then change back the field to be a foreign key. This way, you will force a database alteration which is very important |
48,548,878 | I'm running Django 1.11 with Python 3.4 on Ubuntu 14.04.5
Moving my development code to the test server and running into some strange errors. Can anyone see what is wrong from the traceback?
I'm very new to linux and have made the mistake of developing on a Windows machine on this first go around. I have since create... | 2018/01/31 | [
"https://Stackoverflow.com/questions/48548878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3541909/"
] | In my case, I have the same issue on the development. This command works for me.
```
python manage.py flush
```
Make sure it removes all data from the database. Run this command, it will delete all data from the database and run migration again.
```
python manage.py migrate
``` | In my case @YPCrumble was correct and it was caused after I changed a field from a StreamField to a CharField.
The quickest solution I found was to open up my DB on a GUI (Postico in my case) and overwrite the values from JSON to the default value. This meant setting every existing fields values to 1, in my situation... |
48,548,878 | I'm running Django 1.11 with Python 3.4 on Ubuntu 14.04.5
Moving my development code to the test server and running into some strange errors. Can anyone see what is wrong from the traceback?
I'm very new to linux and have made the mistake of developing on a Windows machine on this first go around. I have since create... | 2018/01/31 | [
"https://Stackoverflow.com/questions/48548878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3541909/"
] | In my case, I have the same issue on the development. This command works for me.
```
python manage.py flush
```
Make sure it removes all data from the database. Run this command, it will delete all data from the database and run migration again.
```
python manage.py migrate
``` | In my case error was thith replace `IntegerField` to `TextField in file migartion
file migration:
```
# Generated by Django 3.1.3 on 2020-12-03 11:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminPanel', '0028_auto_20201203_1117'),
]
op... |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | To install pip3.6 in Amazon Linux., there is no python36-pip.
If you install python34-pip, it will also install python34 and point to it.
The best option that worked for me is the following:
```
#Download get-pip to current directory. It won't install anything, as of now
curl -O https://bootstrap.pypa.io/get-pip.py
... | The above answers seem to apply to python3 not python2
I'm running an instance where the default Python is 2.7
```
python --version
Python 2.7.14
```
I just tried to python-pip but it gave me pip for 2.6
To install pip for python 2.7 I installed the package pyton27-pip
```
sudo yum -y install python27-pip
```
Th... |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | if you have already installed python you might want to install pip by:
sudo yum install python("version")-pip
for example:
```
sudo yum install python34-pip
``` | In my case is using docker with AmazonLinux2 image and python 2.7, I have to enable epel first : <https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/>
Then install by using `yum install python-pip` (because I'm using root user). |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | if you have already installed python you might want to install pip by:
sudo yum install python("version")-pip
for example:
```
sudo yum install python34-pip
``` | There are different ways but this seems to be promising for me.
```
sudo yum install python3-pip
```
I prefer **searching any package name first** and then enter full name which I want to **install**.
```
yum search pip
```
this will give you results if any package with name `pip`.
Check if your installation is ... |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | You can see what is available by executing
```
yum search pip
```
In my case I see
```
...
python2-pip.noarch : A tool for installing and managing Python 2 packages
python3-pip.noarch : A tool for installing and managing Python3 packages
```
So, you can install the version that you need. Since the default instanc... | There are different ways but this seems to be promising for me.
```
sudo yum install python3-pip
```
I prefer **searching any package name first** and then enter full name which I want to **install**.
```
yum search pip
```
this will give you results if any package with name `pip`.
Check if your installation is ... |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | To install pip3.6 in Amazon Linux., there is no python36-pip.
If you install python34-pip, it will also install python34 and point to it.
The best option that worked for me is the following:
```
#Download get-pip to current directory. It won't install anything, as of now
curl -O https://bootstrap.pypa.io/get-pip.py
... | There are different ways but this seems to be promising for me.
```
sudo yum install python3-pip
```
I prefer **searching any package name first** and then enter full name which I want to **install**.
```
yum search pip
```
this will give you results if any package with name `pip`.
Check if your installation is ... |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | The following worked for me on Amazon Linux AMI 2:
`sudo yum -y install python-pip` | I ran into this problem as well. I am using the AWS RHEL 7.5 image.
```
$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
```
I enabled the `extras` and `optional` repos:
```
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
```
But `sudo ... |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | The following worked for me on Amazon Linux AMI 2:
`sudo yum -y install python-pip` | The above answers seem to apply to python3 not python2
I'm running an instance where the default Python is 2.7
```
python --version
Python 2.7.14
```
I just tried to python-pip but it gave me pip for 2.6
To install pip for python 2.7 I installed the package pyton27-pip
```
sudo yum -y install python27-pip
```
Th... |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | Install python and then install pip
```
sudo yum install python34-pip
``` | The above answers seem to apply to python3 not python2
I'm running an instance where the default Python is 2.7
```
python --version
Python 2.7.14
```
I just tried to python-pip but it gave me pip for 2.6
To install pip for python 2.7 I installed the package pyton27-pip
```
sudo yum -y install python27-pip
```
Th... |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | You can see what is available by executing
```
yum search pip
```
In my case I see
```
...
python2-pip.noarch : A tool for installing and managing Python 2 packages
python3-pip.noarch : A tool for installing and managing Python3 packages
```
So, you can install the version that you need. Since the default instanc... | if you have already installed python you might want to install pip by:
sudo yum install python("version")-pip
for example:
```
sudo yum install python34-pip
``` |
45,073,617 | I am use AWS with REL 7. the default EC2 mico instance has already install python.
but it encounter below error when i try to install pip by yum.
sudo yum install pip
====================
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package pip available.
Error: Nothing to do
Anyone advise on how to... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45073617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8035222/"
] | You can see what is available by executing
```
yum search pip
```
In my case I see
```
...
python2-pip.noarch : A tool for installing and managing Python 2 packages
python3-pip.noarch : A tool for installing and managing Python3 packages
```
So, you can install the version that you need. Since the default instanc... | Install python and then install pip
```
sudo yum install python34-pip
``` |
53,093,487 | How can I specify multi-stage build with in a `docker-compose.yml`?
For each variant (e.g. dev, prod...) I have a multi-stage build with 2 docker files:
* dev: `Dockerfile.base` + `Dockerfile.dev`
* or prod: `Dockerfile.base` + `Dockerfile.prod`
File `Dockerfile.base` (common for all variants):
```
FROM python:3.6
... | 2018/10/31 | [
"https://Stackoverflow.com/questions/53093487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3858883/"
] | As mentioned in the comments, a multi-stage build involves a single Dockerfile to perform multiple stages. What you have is a common base image.
You could convert these to a non-traditional multi-stage build with a syntax like (I say non-traditional because you do not perform any copying between the layers and instead... | you can use as well concating of docker-compose files, with including both `dockerfile` pointing to your existing dockerfiles and run `docker-compose -f docker-compose.yml -f docker-compose.prod.yml build` |
37,871,964 | I am calling a second python script that is written for the command line from within my script using
```
os.system('insert command line arguments here')
```
this works fine and runs the second script in the terminal. I would like this not to be output in the terminal and simply have access to the lists and variable... | 2016/06/17 | [
"https://Stackoverflow.com/questions/37871964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1244051/"
] | You have a [circular import](http://effbot.org/zone/import-confusion.htm#circular-imports):
`models.py` is importing `db` from core, and `core.py` is importing `User` from models
You should move this line:
```
from users.models import User
```
to the bottom of `core.py`. That way when `models.py` tries to import `... | It works when you import user from .models in django with version 2 and above |
34,113,000 | I have the following python Numpy function; it is able to take X, an array with an arbitrary number of columns and rows, and output a Y value predicted by a least squares function.
What is the Math.Net equivalent for such a function?
Here is the Python code:
```
newdataX = np.ones([dataX.shape[0],dataX.shape[1]... | 2015/12/06 | [
"https://Stackoverflow.com/questions/34113000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834415/"
] | I think you are looking for the functions on this page: <http://numerics.mathdotnet.com/api/MathNet.Numerics.LinearRegression/MultipleRegression.htm>
You have a few options to solve :
* Normal Equations : `MultipleRegression.NormalEquations(x, y)`
* QR Decomposition : `MultipleRegression.QR(x, y)`
* SVD : `MultipleRe... | You can call numpy from .NET using pythonnet (C# CODE BELOW IS COPIED FROM GITHUB):
The only "funky" part right now with pythonnet is passing numpy arrays. It is possible to convert them to Python lists at the interface, though this reduces performance for some situations.
<https://github.com/pythonnet/pythonnet/tree... |
27,914,930 | I'm trying to install OpenStack python novaclient using pip install python-novaclient
This task fails: netifaces.c:185:6 #error You need to add code for your platform
I have no idea what code it wants.
Does anyone understand this? | 2015/01/13 | [
"https://Stackoverflow.com/questions/27914930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518012/"
] | This has to do with the order that libraries are imported in the netifaces setup.py and is fixed in version 10.3+ (which you need to install from source). Here's how to install 10.4 (current latest release):
```
mkdir -p /tmp/install/netifaces/
cd /tmp/install/netifaces && wget -O "netifaces-0.10.4.tar.gz" "https://py... | I landed on this question while doing something similar:
```
pip install rackspace-novaclient
```
And this is what my error looked like:
```
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-G5GwYu/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().repl... |
27,914,930 | I'm trying to install OpenStack python novaclient using pip install python-novaclient
This task fails: netifaces.c:185:6 #error You need to add code for your platform
I have no idea what code it wants.
Does anyone understand this? | 2015/01/13 | [
"https://Stackoverflow.com/questions/27914930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518012/"
] | I also had this problem, and resolved by
`sudo yum install python-devel python-pip
sudo yum -y install gcc` | This has to do with the order that libraries are imported in the netifaces setup.py and is fixed in version 10.3+ (which you need to install from source). Here's how to install 10.4 (current latest release):
```
mkdir -p /tmp/install/netifaces/
cd /tmp/install/netifaces && wget -O "netifaces-0.10.4.tar.gz" "https://py... |
27,914,930 | I'm trying to install OpenStack python novaclient using pip install python-novaclient
This task fails: netifaces.c:185:6 #error You need to add code for your platform
I have no idea what code it wants.
Does anyone understand this? | 2015/01/13 | [
"https://Stackoverflow.com/questions/27914930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518012/"
] | Same issue in awx\_task container in AWX project (Centos 7), trying to execute
```
pip install python-openstackclient
```
Error was:
```
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-LTchWP/netifaces/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace(... | This has to do with the order that libraries are imported in the netifaces setup.py and is fixed in version 10.3+ (which you need to install from source). Here's how to install 10.4 (current latest release):
```
mkdir -p /tmp/install/netifaces/
cd /tmp/install/netifaces && wget -O "netifaces-0.10.4.tar.gz" "https://py... |
27,914,930 | I'm trying to install OpenStack python novaclient using pip install python-novaclient
This task fails: netifaces.c:185:6 #error You need to add code for your platform
I have no idea what code it wants.
Does anyone understand this? | 2015/01/13 | [
"https://Stackoverflow.com/questions/27914930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518012/"
] | I also had this problem, and resolved by
`sudo yum install python-devel python-pip
sudo yum -y install gcc` | I landed on this question while doing something similar:
```
pip install rackspace-novaclient
```
And this is what my error looked like:
```
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-G5GwYu/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().repl... |
27,914,930 | I'm trying to install OpenStack python novaclient using pip install python-novaclient
This task fails: netifaces.c:185:6 #error You need to add code for your platform
I have no idea what code it wants.
Does anyone understand this? | 2015/01/13 | [
"https://Stackoverflow.com/questions/27914930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518012/"
] | Same issue in awx\_task container in AWX project (Centos 7), trying to execute
```
pip install python-openstackclient
```
Error was:
```
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-LTchWP/netifaces/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace(... | I landed on this question while doing something similar:
```
pip install rackspace-novaclient
```
And this is what my error looked like:
```
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-G5GwYu/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().repl... |
71,870,864 | I'm writing a python tool with modules at different 'levels':
* A low-level module, that can do everything, with a bit of work
* A higher level module, with added "sugar" and helper functions
I would like to be able to share function signatures from the low-level module to the higher one, so that intellisense works w... | 2022/04/14 | [
"https://Stackoverflow.com/questions/71870864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2486378/"
] | While `args` [won't be null](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/main-command-line#command-line-arguments) (See the green **Tip** box in the link), it might be an Array of length 0.
So `args[0]` doesn't exist because it refers to the first item in the array, which doesn't hav... | How do you start Main function (program)? Do you pass arguments to Main function? If not, lenght of your args array is 0 (you don't have any fields in that array). |
71,870,864 | I'm writing a python tool with modules at different 'levels':
* A low-level module, that can do everything, with a bit of work
* A higher level module, with added "sugar" and helper functions
I would like to be able to share function signatures from the low-level module to the higher one, so that intellisense works w... | 2022/04/14 | [
"https://Stackoverflow.com/questions/71870864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2486378/"
] | While `args` [won't be null](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/main-command-line#command-line-arguments) (See the green **Tip** box in the link), it might be an Array of length 0.
So `args[0]` doesn't exist because it refers to the first item in the array, which doesn't hav... | You are checking `input.Length` but you are *accessing* `inputArray[i]`. |
71,870,864 | I'm writing a python tool with modules at different 'levels':
* A low-level module, that can do everything, with a bit of work
* A higher level module, with added "sugar" and helper functions
I would like to be able to share function signatures from the low-level module to the higher one, so that intellisense works w... | 2022/04/14 | [
"https://Stackoverflow.com/questions/71870864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2486378/"
] | You are checking `input.Length` but you are *accessing* `inputArray[i]`. | How do you start Main function (program)? Do you pass arguments to Main function? If not, lenght of your args array is 0 (you don't have any fields in that array). |
56,695,227 | I'm using `tf.estimator` API with TensorFlow 1.13 on Google AI Platform to build a DNN Binary Classifier. For some reason I don't get a `eval` graph but I do get a `training` graph.
Here are two different methods for performing training. The first is the normal python method and the second is using GCP AI Platform in ... | 2019/06/20 | [
"https://Stackoverflow.com/questions/56695227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008596/"
] | With the comment and suggestions as well as tweaking the parameters, here is the result which works for me.
The code to start the tensorboard, train the model etc. Using ------- to denote a notebook cell
---
```
%%bash
# clean model output dirs
# This is so that the trained model is deleted
output_dir=${PWD}/${TRAIN... | In `estimator.train_and_evaluate()` you specify a `train_spec` and an `eval_spec`. The `eval_spec` often has a different input function (e.g. development evaluation dataset, non-shuffled)
Every N steps, a checkpoint from the train process is saved, and the eval process loads those same weights and runs according to th... |
71,276,514 | I had everything working fine, then out of nowhere I keep getting this
```
PS C:\Users\rygra\Documents\Ryan Projects\totalwine-product-details-scraper> ensurepip
ensurepip : The term 'ensurepip' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or... | 2022/02/26 | [
"https://Stackoverflow.com/questions/71276514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18312732/"
] | Add param `android:exported` in `AndroidManifest.xml` file under `activity`
Like below code:
```
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.int... | Goto **AndroidManifest.xml** and add the following line to each activity
```
<activity
android:name=".MainActivity"
android:exported="true" />
``` |
12,755,804 | I am trying to run a python script on my mac .I am getting the error :-
>
> ImportError: No module named opengl.opengl
>
>
>
I googled a bit and found that I was missing pyopengl .I installed pip.I go to the directory pip-1.0 and then say
>
> sudo pip install pyopengl
>
>
>
and it installs correctly I beli... | 2012/10/06 | [
"https://Stackoverflow.com/questions/12755804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/592667/"
] | Is it in the PYTHON-PATH? Maybe try something like this:
```
import sys
sys.path.append(opengl-dir)
import opengl.opengl
```
Replace the opengl-dir with the directory that you have installed in...
Maybe try what RocketDonkey is suggesting...
I don't know, really... | Thanks guys! I figured it out.It was infact a separate module which I needed to copy over to the "site-packages" location and it worked fine.So in summary no issues with the path just that the appropriate module was not there. |
11,713,871 | I am playing with Heroku to test how good it is for Django apps.
I created a simple project with two actions:
1. return simple hello world
2. generate image and send it as response
I used `siege -c10 -t30s` to test both Django dev server and gunicorn (both running on Heroku). These are my results:
**Simple hello w... | 2012/07/29 | [
"https://Stackoverflow.com/questions/11713871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/513686/"
] | Are settings the same? Django 1.4 dev server is multithreaded by default and there is only 1 sync worker in gunicorn default config. | You're going to have to set up [application profiling](http://docs.python.org/library/profile.html) to gain some insight into where exactly the problem is located. |
11,713,871 | I am playing with Heroku to test how good it is for Django apps.
I created a simple project with two actions:
1. return simple hello world
2. generate image and send it as response
I used `siege -c10 -t30s` to test both Django dev server and gunicorn (both running on Heroku). These are my results:
**Simple hello w... | 2012/07/29 | [
"https://Stackoverflow.com/questions/11713871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/513686/"
] | Are settings the same? Django 1.4 dev server is multithreaded by default and there is only 1 sync worker in gunicorn default config. | Maybe the speed of your Internet connection is a bottleneck? Downloading data from Heroku is obviously slower than moving it through localhost (I assume django dev server is run at localhost). This may explain why benchmarks with small responses (hellowords) are equally fast and the benchmarks with large responses (ima... |
45,877,080 | I'm trying to create a dropdown menu in HTML using info from a python script. I've gotten it to work thus far, however, the html dropdown displays all 4 values in the lists as 4 options.
Current: **Option 1:** Red, Blue, Black Orange; **Option 2:** Red, Blue, Black, Orange etc. (Screenshot in link)
[Current](https://i... | 2017/08/25 | [
"https://Stackoverflow.com/questions/45877080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8515504/"
] | you have a typo, replace `colours` to `colour`
```
<option value= "{{colour}}" SELECTED>{{colours}}</option>"
```
replace to
```
<option value= "{{colour}}" SELECTED>{{ colour }}</option>"
<!-- ^^^^ -->
``` | You need to use `{{colour}}` in both places (instead of `{{colours}}` in the second place):
```
<select name="colour" method="GET" action="/">
{% for colour in colours %}
<option value="{{colour}}" SELECTED>{{colour}}</option>"
{% endfor %}
</select>
```
Note that using `selected` inside the loop wil... |
37,691,552 | I have the following code that is leveraging multiprocessing to iterate through a large list and find a match. How can I get all processes to stop once a match is found in any one processes? I have seen examples but I none of them seem to fit into what I am doing here.
```
#!/usr/bin/env python3.5
import sys, itertool... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37691552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109254/"
] | You can check [this question](https://stackoverflow.com/questions/33447055/python-multiprocess-pool-how-to-exit-the-script-when-one-of-the-worker-process/33450972#33450972) to see an implementation example solving your problem.
This works also with concurrent.futures pool.
Just replace the `map` method with `apply_as... | `multiprocessing` isn't really designed to cancel tasks, but you can simulate it for your particular case by using `pool.imap_unordered` and terminating the pool when you get a hit:
```
def do_job(first_bits):
for x in itertools.product(first_bits, *itertools.repeat(alphabet, num_parts-1)):
# CHECK FOR MAT... |
21,995,255 | i'm trying to use BeautifulSoup on my NAS, that is the model in the title, but i am not able to install it, with the `ipkg list` there isn't a package named BeautifulSoup.
On my NAS i have this version of python:
```
Python 2.5.6 (r256:88840, Feb 16 2012, 08:51:29)
[GCC 3.4.3 20041021 (prerelease)] on linux2
```
So... | 2014/02/24 | [
"https://Stackoverflow.com/questions/21995255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/678833/"
] | In this case I suppose that you can't even install pip to manage your Python dependencies. One way of doing so would be to download the source from <http://www.crummy.com/software/BeautifulSoup/bs3/download//3.x/>, download the tarball for your preferred version. Once done, unzip it cd into the folder and type:
```
$ ... | You can if you install python3 from the package manager:
```
ashton@NASty:~/bin/three/$ pip install beautifulsoup4 -- user
Requirement already satisfied: beautifulsoup4 in
/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages (4.8.0)
Requirement already satisfied: soupsieve>=1.2 in
/volume1/@appstore/py3k/u... |
39,215,663 | I think I have the same issue as [here on SO.](https://stackoverflow.com/questions/28323644/flask-sqlalchemy-backref-not-working) Using python 3.5, flask-sqlalchemy, and sqlite. I am trying to establish a one (User) to many (Post) relationship.
```
class User(db_blog.Model):
id = db_blog.Column(db_blog.Integer, pr... | 2016/08/29 | [
"https://Stackoverflow.com/questions/39215663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5795832/"
] | If you add the newly created `post` to the `posts` attribute of the user, it will work:
```
>>> u = User(nickname="John Doe", email="[email protected]")
>>> u
<User: John Doe>
>>> db_blog.session.add(u)
>>> p = Post(body="Body of post", title="Title of Post")
>>> p
<Title: Title of Post
Post: Body of post
Author: None>
>... | You added your own `__init__` to `Post`. While it accepts keyword arguments, it does nothing with them. You can either update it to use them
```
def __init__(self, body, title, **kwargs):
self.body = body
self.title = title
for k, v in kwargs:
setattr(self, k, v)
```
Or, ideally, you can just re... |
15,481,808 | I'm trying to set the figure size with `fig1.set_size_inches(5.5,3)` on python, but the plot produces a fig where the x label is not completely visibile. The figure itself has the size I need, but it seems like the axis inside is too tall, and the x label just doesn't fit anymore.
here is my code:
```
fig1 = plt.fig... | 2013/03/18 | [
"https://Stackoverflow.com/questions/15481808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1862909/"
] | You could order the save method to take the artist of the x-label into consideration.
This is done with the bbox\_extra\_artists and the tight layout.
The resulting code would be:
```
import matplotlib.pyplot as plt
fig1 = plt.figure()
fig1.set_size_inches(5.5,4)
fig1.set_dpi(300)
ax = fig1.add_subplot(111)
ax.grid(... | It works for me if I initialize the figure with the `figsize` and `dpi` as `kwargs`:
```
from numpy import random
from matplotlib import pyplot as plt
driveDistance = random.exponential(size=100)
fig1 = plt.figure(figsize=(5.5,4),dpi=300)
ax = fig1.add_subplot(111)
ax.grid(True,which='both')
ax.hist(driveDistance,100)... |
42,903,036 | I am trying to find any way possible to get a SharePoint list in Python. I was able to connect to SharePoint and get the XML data using Rest API via this video: <https://www.youtube.com/watch?v=dvFbVPDQYyk>... but not sure how to get the list data into python. The ultimate goal will be to get the SharePoint data and im... | 2017/03/20 | [
"https://Stackoverflow.com/questions/42903036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7418496/"
] | ```
from shareplum import Site
from requests_ntlm import HttpNtlmAuth
server_url = "https://sharepoint.xxx.com/"
site_url = server_url + "sites/org/"
auth = HttpNtlmAuth('xxx\\user', 'pwd')
site = Site(site_url, auth=auth, verify_ssl=False)
sp_list = site.List('list name in my share point')
data = sp_list.GetListItem... | I know this doesn't directly answer your question (and you probably have an answer by now) but I would give the [SharePlum](https://pypi.org/project/SharePlum/) library a try. It should hopefully [simplify](https://shareplum.readthedocs.io/en/latest/index.html) the process you have for interacting with SharePoint.
Als... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.