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
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
Use `tf.keras.optimizers.Adam(learning_rate)` instead of `keras.optimizers.Adam(learning_rate)`
There are ways to solve your problem as you are using keras 2.6 and tensorflow too: * use (from keras.optimizer\_v2.adam import Adam as Adam) but go through the function documentation once to specify your learning rate and beta values * you can also use (Adam = keras.optimizers.Adam). * (import tensorflow as tf) then ...
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
As per the [documentation](https://keras.io/api/optimizers/) , try to import `keras` into your code like this, ``` >>> from tensorflow import keras ``` This has helped me as well.
Make sure you've imported tensorflow: ``` import tensorflow as tf ``` Then use ``` tf.optimizers.Adam(learning_rate) ```
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
As per the [documentation](https://keras.io/api/optimizers/) , try to import `keras` into your code like this, ``` >>> from tensorflow import keras ``` This has helped me as well.
There are ways to solve your problem as you are using keras 2.6 and tensorflow too: * use (from keras.optimizer\_v2.adam import Adam as Adam) but go through the function documentation once to specify your learning rate and beta values * you can also use (Adam = keras.optimizers.Adam). * (import tensorflow as tf) then ...
69,334,001
When i am using "optimizer = keras.optimizers.Adam(learning\_rate)" i am getting this error "AttributeError: module 'keras.optimizers' has no attribute 'Adam". I am using python3.8 keras 2.6 and backend tensorflow 1.13.2 for running the program. Please help to resolve !
2021/09/26
[ "https://Stackoverflow.com/questions/69334001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17007363/" ]
Make sure you've imported tensorflow: ``` import tensorflow as tf ``` Then use ``` tf.optimizers.Adam(learning_rate) ```
There are ways to solve your problem as you are using keras 2.6 and tensorflow too: * use (from keras.optimizer\_v2.adam import Adam as Adam) but go through the function documentation once to specify your learning rate and beta values * you can also use (Adam = keras.optimizers.Adam). * (import tensorflow as tf) then ...
60,631,553
I would like to parametize the columns and my dataframe in an cursor.execute function. I'm using pymssql, because I like the fact that I can name the parametized columns. Yet I still don't know how to properly tell python that I'm referring to a specific dataframe and I would like to use this columns. Here is the last ...
2020/03/11
[ "https://Stackoverflow.com/questions/60631553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12790189/" ]
I had the same issue. Try to add after your Proxy: `RequestHeader set X-Forwarded-Proto https` to your `...ssl.conf` which is in sites-available folder.
I had same issue, I was trying to setup a SSL termination reverse proxy with apache. I followed this [article](https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension). Using `0.0.0.0` instead of localhost worked for me. ``` <IfModule mod_ssl.c> <V...
1,383,863
If you install multiple versions of python (I currently have the default 2.5, installed 3.0.1 and now installed 2.6.2), it automatically puts stuff in `/usr/local`, and it also adjusts the path to include the `/Library/Frameworks/Python/Versions/theVersion/bin`, but whats the point of that when `/usr/local` is already ...
2009/09/05
[ "https://Stackoverflow.com/questions/1383863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/148195/" ]
There's no a priori guarantee that /usr/local/bin will stay on the PATH (especially it will not necessarily stay "in front of" /usr/bin!-), so it's perfectly reasonable for an installer to ensure the specifically needed /Library/.../bin directory does get on the PATH. Plus, it may be the case that the /Library/.../bin ...
I just noticed/encountered this issue on my Mac. I have Python 2.5.4, 2.6.2, and 3.1.1 on my machine, and was looking for a way to easily change between them at will. That is when I noticed all the symlinks for the executables, which I found in both '/usr/bin' and '/usr/local/bin'. I ripped all the non-version specific...
58,113,118
I have a python script that connect PostgresSQL. Below is the script. ``` import psycopg2 conn = psycopg2.connect('connection string') try: curr = conn.cursor() sql_strng = "SELECT * FROM tbl" ### Further operations### except(Exception, psycopg2.Error) as error: print("error",error) finally: if (conn...
2019/09/26
[ "https://Stackoverflow.com/questions/58113118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7290715/" ]
Just use `this.types.filter(({id}) => !this.selected_types.includes(id))`: ```js let types = [{ id: 1, name: "Hello" }, { id: 2, name: "World" }, { id: 3, name: "Jon Doe" } ] let selected_types = [1, 2]; let resArr = types.filter(({id}) => !selected_types.includes(id));...
**You can achieve Javascript's native method filter, which finally returns a new object** ``` let types = [{ id: 1, name: "Hello" }, { id: 2, name: "World" }, { id: 3, name: "Jon Doe" } ] let selected_types = [1, 2]; types = types.filter(obj => { if (selected_types.indexOf(obj.id)...
37,442,993
I have a csv file I wish to load into pandas, but the formatting is giving me some problems. The file is such: > > Version 1 > > > ,Date Time,Name,Value > > > ,26/Jan/2016 07:35:52,Name1,340rqi > > > ,26/Jan/2016 07:00:00,Name2,1.00E+005 > > > ,26/Jan/2016 07:00:00,Name3,pulled\_9 > > > (It's a mess of a ...
2016/05/25
[ "https://Stackoverflow.com/questions/37442993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6382244/" ]
> > When is DbConnection.StateChange called? > > > You can find out by looking at the Microsoft reference source code. The [`StateChange`](http://referencesource.microsoft.com/#System.Data/System/Data/Common/DBConnection.cs,191b2f1d559f7e8d) event is raised by the [`DbConnection.OnStateChange`](http://referenceso...
The `StateChange` event is meant for the state of the connection, not the instance of the database server. To get the state of the database server, > > The StateChange event occurs when the state of the event changes from > closed to opened, or opened to closed. > > > From MSDN: <https://msdn.microsoft.com/en-u...
12,850,550
I'm reading conflicting reports about using PostgreSQL on Amazon's Elastic Beanstalk for python (Django). Some sources say it isn't possible: (http://www.forbes.com/sites/netapp/2012/08/20/amazon-cloud-elastic-beanstalk-paas-python/). I've been through a dummy app setup, and it does seem that MySQL is the only option...
2012/10/12
[ "https://Stackoverflow.com/questions/12850550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1133318/" ]
Postgre is now selectable from the AWS RDS configurations. Validated through Elastic Beanstalk application setup 2014-01-27.
> > Is it possible to run a PostgreSQL database with a Django app on > Elastic Beanstalk? > > > Yes. The dummy app setup you mention refers to the use of an Amazon Relational Database Service. At the moment PostgreSQL is not available as an Amazon RDS, but you can configure your beanstalk AMI to act as a local Po...
65,238,577
I have a simple Users resource with a put method to update all user information except user password. According to Flask-Restx docs when a model has set the strict and validation params to true, a validation error will be thrown if an unspecified param is provided in the request. However, this doesn't seem to be workin...
2020/12/10
[ "https://Stackoverflow.com/questions/65238577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8184470/" ]
I resolved my issue by pulling the latest version of Flask-RESTX from Github. The strict parameter for models was merged after Flask-RESTX version 0.2.0 was released on Pypi in March of 2020 (see the closed [issue](https://github.com/python-restx/flask-restx/issues/264) in Flask-RESTX repo for more context). My confusi...
It's been a while since I touched on this but from what I can tell, I don't think you are using the strict param correctly. From the documentation [here](https://flask-restx.readthedocs.io/en/latest/_modules/flask_restx/model.html), the `:param bool strict` is defined as > > :param bool strict: validation should rais...
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
Another possibility that works for an arbitrary number of arguments: ``` from collections import Counter def lone_sum(*args): return sum(x for x, c in Counter(args).items() if c == 1) ``` Note that in Python 2, you should use `iteritems` to avoid building a temporary list.
``` def lone_sum(a, b, c): z = (a,b,c) x = [] for item in z: if z.count(item)==1: x.append(item) return sum(x) ```
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
Had a very similar approach to what you had: ``` def lone_sum(a, b, c): if a != b and b != c and c != a: return a + b + c elif a == b == c: return 0 elif a == b: return c elif b == c: return a elif c == a: return b ``` Since if 2 values are the same the code will automatically retur...
I tried this on Codingbat but it doesn`t work, although it does on the code editor. def lone\_sum(a, b, c): s = set([a,b,c]) return sum(s)
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
A more general solution for any number of arguments is ``` def lone_sum(*args): seen = set() summands = set() for x in args: if x not in seen: summands.add(x) seen.add(x) else: summands.discard(x) return sum(summands) ```
Could use a defaultdict to screen out any elements appearing more than once. ``` from collections import defaultdict def lone_sum(*args): d = defaultdict(int) for x in args: d[x] += 1 return sum( val for val, apps in d.iteritems() if apps == 1 ) ```
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
Could use a defaultdict to screen out any elements appearing more than once. ``` from collections import defaultdict def lone_sum(*args): d = defaultdict(int) for x in args: d[x] += 1 return sum( val for val, apps in d.iteritems() if apps == 1 ) ```
I tried this on Codingbat but it doesn`t work, although it does on the code editor. def lone\_sum(a, b, c): s = set([a,b,c]) return sum(s)
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
Another possibility that works for an arbitrary number of arguments: ``` from collections import Counter def lone_sum(*args): return sum(x for x, c in Counter(args).items() if c == 1) ``` Note that in Python 2, you should use `iteritems` to avoid building a temporary list.
A more general solution for any number of arguments is ``` def lone_sum(*args): seen = set() summands = set() for x in args: if x not in seen: summands.add(x) seen.add(x) else: summands.discard(x) return sum(summands) ```
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
A more general solution for any number of arguments is ``` def lone_sum(*args): seen = set() summands = set() for x in args: if x not in seen: summands.add(x) seen.add(x) else: summands.discard(x) return sum(summands) ```
Had a very similar approach to what you had: ``` def lone_sum(a, b, c): if a != b and b != c and c != a: return a + b + c elif a == b == c: return 0 elif a == b: return c elif b == c: return a elif c == a: return b ``` Since if 2 values are the same the code will automatically retur...
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
How about: ``` def lone_sum(*args): return sum(v for v in args if args.count(v) == 1) ```
``` def lone_sum(a, b, c): z = (a,b,c) x = [] for item in z: if z.count(item)==1: x.append(item) return sum(x) ```
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
Another possibility that works for an arbitrary number of arguments: ``` from collections import Counter def lone_sum(*args): return sum(x for x, c in Counter(args).items() if c == 1) ``` Note that in Python 2, you should use `iteritems` to avoid building a temporary list.
Had a very similar approach to what you had: ``` def lone_sum(a, b, c): if a != b and b != c and c != a: return a + b + c elif a == b == c: return 0 elif a == b: return c elif b == c: return a elif c == a: return b ``` Since if 2 values are the same the code will automatically retur...
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
How about: ``` def lone_sum(*args): return sum(v for v in args if args.count(v) == 1) ```
Could use a defaultdict to screen out any elements appearing more than once. ``` from collections import defaultdict def lone_sum(*args): d = defaultdict(int) for x in args: d[x] += 1 return sum( val for val, apps in d.iteritems() if apps == 1 ) ```
10,816,816
I was doing some practice problems in [Coding Bat](http://codingbat.com/python), and came across this one.. ``` Given 3 int values, a b c, return their sum. However, if one of the values is the same as another of the values, it does not count towards the sum. lone_sum(1, 2, 3) β†’ 6 lone_sum(3, 2, 3) β†’ 2 lone_sum(3, 3...
2012/05/30
[ "https://Stackoverflow.com/questions/10816816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088536/" ]
A more general solution for any number of arguments is ``` def lone_sum(*args): seen = set() summands = set() for x in args: if x not in seen: summands.add(x) seen.add(x) else: summands.discard(x) return sum(summands) ```
I tried this on Codingbat but it doesn`t work, although it does on the code editor. def lone\_sum(a, b, c): s = set([a,b,c]) return sum(s)
47,286,349
i need a simple python code which makes a number menu, that doesn't take up many lines ``` print ("Pick an option") menu =0 Menu = input(""" 1. Check Password 2. Generate Password 3. Quit """) if (menu) == 1: Password = input("Please enter the password you want to check") ...
2017/11/14
[ "https://Stackoverflow.com/questions/47286349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8938872/" ]
You problem seems to arise from the fact that you use `flatMap` so if there is no data in the DB for a given `id` and you get an empty `Observable`, `flatMap` just produces no output for such `id`. So it looks like what you need is [defaultIfEmpty](http://reactivex.io/documentation/operators/defaultifempty.html) which ...
One way of doing this is the following: **(1)** convert sequence of ids to `Observable` and `map` it with ``` id => (id, false) ``` ... so you'll get an observable of type `Observable[(Int, Boolean)]` (lets call this new observable `first`). **(2)** fetch data from database and `map` every fetched row to from: ``...
47,286,349
i need a simple python code which makes a number menu, that doesn't take up many lines ``` print ("Pick an option") menu =0 Menu = input(""" 1. Check Password 2. Generate Password 3. Quit """) if (menu) == 1: Password = input("Please enter the password you want to check") ...
2017/11/14
[ "https://Stackoverflow.com/questions/47286349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8938872/" ]
You problem seems to arise from the fact that you use `flatMap` so if there is no data in the DB for a given `id` and you get an empty `Observable`, `flatMap` just produces no output for such `id`. So it looks like what you need is [defaultIfEmpty](http://reactivex.io/documentation/operators/defaultifempty.html) which ...
how about this ``` Observable.from(idsToFetch) .filterNot(x => x._1 == 4 || x._1 == 5 || x._1 == 6) .foldLeft(idToFetch.map{_->false}.toMap){(m,id)=>m+(id->true)} ```
13,047,458
I'm trying to set speed limits on downloading/uploading files and found that twisted provides [twisted.protocols.policies.ThrottlingFactory](http://twistedmatrix.com/documents/current/api/twisted.protocols.policies.ThrottlingFactory.html) to handle this job, but I can't get it right. I set `readLimit` and `writeLimit`,...
2012/10/24
[ "https://Stackoverflow.com/questions/13047458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1770691/" ]
This does **not** look like **clustering** to me. Instead, I figure you want a simple **decision tree classification**. It should already be available in Rapidminer.
You could use the "Generate Attributes" operator. This creates new attributes from existing ones. It would be relatively tiresome to create all the rules but they would be something like cluster : if (((A==0)&&(B==0)&&(C==0)),1,0)
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
Did you try to escape percents with `%%`?
There's `RawConfigParser` which is like `ConfigParser` without the interpolation behaviour. If you don't use the interpolation feature in any other part of the configuration file, you can simply replace `ConfigParser` with `RawConfigParser` in your code. See the documentation of [RawConfigParser](http://docs.python.or...
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
Did you try to escape percents with `%%`?
You can also use interpolation set to `None`. ``` config = ConfigParser(strict=False, interpolation=None) ``` (I am using Python `3.6.0`)
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
You can also use interpolation set to `None`. ``` config = ConfigParser(strict=False, interpolation=None) ``` (I am using Python `3.6.0`)
There's `RawConfigParser` which is like `ConfigParser` without the interpolation behaviour. If you don't use the interpolation feature in any other part of the configuration file, you can simply replace `ConfigParser` with `RawConfigParser` in your code. See the documentation of [RawConfigParser](http://docs.python.or...
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
You might wanna use `ConfigParser.RawConfigParser` instead of `ConfigParser.ConfigParser`. Only the latter does magical interpolation on config values. **EDIT:** Actually, using `ConfigParser.SafeConfigParser` you'll able to escape format strings with an additional `%` percent sign. This example should be working the...
What is the problem with the code above? Interpolation is only performed if the `%` operator is applied to the string. If you don't use `%` you can use the formatting string like any other string.
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
Did you try to escape percents with `%%`?
What is the problem with the code above? Interpolation is only performed if the `%` operator is applied to the string. If you don't use `%` you can use the formatting string like any other string.
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
You can also use interpolation set to `None`. ``` config = ConfigParser(strict=False, interpolation=None) ``` (I am using Python `3.6.0`)
What version of Python are you using? An upgrade to 2.6.4 may help, see <http://bugs.python.org/issue5741>
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
There's `RawConfigParser` which is like `ConfigParser` without the interpolation behaviour. If you don't use the interpolation feature in any other part of the configuration file, you can simply replace `ConfigParser` with `RawConfigParser` in your code. See the documentation of [RawConfigParser](http://docs.python.or...
What version of Python are you using? An upgrade to 2.6.4 may help, see <http://bugs.python.org/issue5741>
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
You can also use interpolation set to `None`. ``` config = ConfigParser(strict=False, interpolation=None) ``` (I am using Python `3.6.0`)
What is the problem with the code above? Interpolation is only performed if the `%` operator is applied to the string. If you don't use `%` you can use the formatting string like any other string.
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
Did you try to escape percents with `%%`?
You might wanna use `ConfigParser.RawConfigParser` instead of `ConfigParser.ConfigParser`. Only the latter does magical interpolation on config values. **EDIT:** Actually, using `ConfigParser.SafeConfigParser` you'll able to escape format strings with an additional `%` percent sign. This example should be working the...
2,537,929
I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a separate file that handles the reading and writing of the config file....
2010/03/29
[ "https://Stackoverflow.com/questions/2537929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56815/" ]
There's `RawConfigParser` which is like `ConfigParser` without the interpolation behaviour. If you don't use the interpolation feature in any other part of the configuration file, you can simply replace `ConfigParser` with `RawConfigParser` in your code. See the documentation of [RawConfigParser](http://docs.python.or...
What is the problem with the code above? Interpolation is only performed if the `%` operator is applied to the string. If you don't use `%` you can use the formatting string like any other string.
15,863,657
Kinda a newbie in python, starting to lean on how python works with strings and iteration over strings. Had worked on a chunk of so-called code 'Palindrome', would you take a look at which part exactly it is going wrong? ``` def palindrome(s): if len(s) < 1: return True else: i = 0 j = ...
2013/04/07
[ "https://Stackoverflow.com/questions/15863657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540033/" ]
Below you have a little less complicated solution: ``` def is_palindrome(s): return s == s[::-1] ``` In your version you are always returning `True` for all strings with `len(s) >= 1`
I may be missing something obvious, but shouldn't this be enough? ``` def ispalindrome(s): return s == s[::-1] ```
23,554,644
I was able to get my flask app running as a service thanks to [Is it possible to run a Python script as a service in Windows? If possible, how?](https://stackoverflow.com/questions/32404/is-it-possible-to-run-a-python-script-as-a-service-in-windows-if-possible-how), but when it comes to stopping it i cannot. I have to ...
2014/05/09
[ "https://Stackoverflow.com/questions/23554644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2917993/" ]
You can stop the Werkzeug web server gracefully before you stop the Win32 server. Example: ``` from flask import request def shutdown_server(): func = request.environ.get('werkzeug.server.shutdown') if func is None: raise RuntimeError('Not running with the Werkzeug Server') func() @app.route('/sh...
I recommend you use <http://supervisord.org/>. Actually not work in Windows, but with Cygwin you can run supervisor as in Linux, including run as service. For install Supervisord: <https://stackoverflow.com/a/18032347/3380763> After install you must configure the app, here an example: <http://flaviusim.com/blog/Deplo...
23,554,644
I was able to get my flask app running as a service thanks to [Is it possible to run a Python script as a service in Windows? If possible, how?](https://stackoverflow.com/questions/32404/is-it-possible-to-run-a-python-script-as-a-service-in-windows-if-possible-how), but when it comes to stopping it i cannot. I have to ...
2014/05/09
[ "https://Stackoverflow.com/questions/23554644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2917993/" ]
You can stop the Werkzeug web server gracefully before you stop the Win32 server. Example: ``` from flask import request def shutdown_server(): func = request.environ.get('werkzeug.server.shutdown') if func is None: raise RuntimeError('Not running with the Werkzeug Server') func() @app.route('/sh...
You could also trick Flask into believing you pressed `Ctrl` + `C`: ``` def shutdown_flask(self): from win32api import GenerateConsoleCtrlEvent CTRL_C_EVENT = 0 GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0) ``` Then simply call `shutdown_flask()` in your `SvcStop()`: ``` try: # try to exit gracefully ...
1,817,780
I have created a python script which pulls data out of OLE streams in Word documents, but am having trouble converting the OLE2-formatted timestamp to something more human-readable :( The timestamp which is pulled out is 12760233021 but I cannot for the life of me convert this to a date like 12 Mar 2007 or similar. A...
2009/11/30
[ "https://Stackoverflow.com/questions/1817780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Well, Python 3.0 and 3.1 are already released, so you can check this out for yourself. The end result was that map and filter were kept as built-ins, and lambda was also kept. The only change was that reduce was moved to the functools module; you just need to do ``` from functools import reduce ``` to use it. Futur...
In Python 3.x, Python continues to have a rich set of functional-ish tools built in: list comprehensions, generator expressions, iterators and generators, and functions like `any()` and `all()` that have short-circuit evaluation wherever possible. Python's "Benevolent Dictator For Life" floated the idea of removing `m...
55,118,630
Is there a way to start a python script on a server from a webpage? At work I've made a simple python script using selenium to do a routine job (open a webpage and click a few buttons). I want to be able to start this remotely (still on company network) but due to security/permissions here at work I can't use telnet/...
2019/03/12
[ "https://Stackoverflow.com/questions/55118630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3379555/" ]
Strings are immutable. They cannot change. Any action you perform on them will result in a "new" string that is returned by the method you called upon it. Read more about it: [Immutability of Strings in Java](https://stackoverflow.com/questions/1552301/immutability-of-strings-in-java) So in your example, if you wish ...
You can reassign `tempString` with its new value : ``` String tempString= "abc is very easy"; tempString = tempString.replace("very","not"); System.out.println("tempString is "+tempString); ``` Result is : ``` tempString is abc is not easy ``` Best
29,999,482
I try to "click" Javascript alert for reboot confirmation in DSL modem with a Python script as follows: ``` #!/usr/bin/env python import selenium import time from selenium import webdriver cap = {u'acceptSslCerts': True, u'applicationCacheEnabled': True, u'browserConnectionEnabled': True, u'browserName': u'phantomjs...
2015/05/02
[ "https://Stackoverflow.com/questions/29999482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2022518/" ]
As PhantomJs has no support for Alert boxes .you need to use executor for this. ``` driver.execute_script("window.confirm = function(msg) { return true; }"); ```
In java, driver.switchTo().alert().accept(); will do the job. I am not sure, why you are using "print al.accept()", probably are you trying to print text? then alert.getText() will do in java, sorry if i am wrong, because i am sure in python. Thank You, Murali <http://seleniumtrainer.com/>
69,694,596
This is my code. It should send message to the channel when user join the server. ```py @client.event async def on_member_join(member): print('+') #this works perfectly ch = client.get_channel(84319995256905728) await ch.send(f"{member.name} has joined") ``` But error was occur. This is the output: ```p...
2021/10/24
[ "https://Stackoverflow.com/questions/69694596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17067135/" ]
You can approximate the requirement this way: ``` from collections.abc import Iterable def f2(sequence_type, *elements): if isinstance(elements[0],Iterable): return sequence_type(elements[0]) else: return sequence_type(elements[:1]) ``` which is close, but fails for `f(list, 'ab')` which ret...
The examples for `str` doesn't really fit the description of the function, but here are some implementations that pass your test cases - you want to wrap the element into a collection first for tuple/list/set before converting: ```py def f(sequence_type, element): return sequence_type([element] if sequence_type !=...
69,694,596
This is my code. It should send message to the channel when user join the server. ```py @client.event async def on_member_join(member): print('+') #this works perfectly ch = client.get_channel(84319995256905728) await ch.send(f"{member.name} has joined") ``` But error was occur. This is the output: ```p...
2021/10/24
[ "https://Stackoverflow.com/questions/69694596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17067135/" ]
You can approximate the requirement this way: ``` from collections.abc import Iterable def f2(sequence_type, *elements): if isinstance(elements[0],Iterable): return sequence_type(elements[0]) else: return sequence_type(elements[:1]) ``` which is close, but fails for `f(list, 'ab')` which ret...
You can try this one: ``` def f(sequence_type, element): g = lambda *args: args return str(g(element)[0]) if str==sequence_type else sequence_type(g(element)) ```
69,694,596
This is my code. It should send message to the channel when user join the server. ```py @client.event async def on_member_join(member): print('+') #this works perfectly ch = client.get_channel(84319995256905728) await ch.send(f"{member.name} has joined") ``` But error was occur. This is the output: ```p...
2021/10/24
[ "https://Stackoverflow.com/questions/69694596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17067135/" ]
You can approximate the requirement this way: ``` from collections.abc import Iterable def f2(sequence_type, *elements): if isinstance(elements[0],Iterable): return sequence_type(elements[0]) else: return sequence_type(elements[:1]) ``` which is close, but fails for `f(list, 'ab')` which ret...
I think that you want to change the behavior of the literals, in particular for the case `str`-`list`. Since the changes are decided by you it means that you have to make either a case-study with `if`-`else` or by bypassing it in some tricky way. In my solution I choose the latter but I required only a conditional for ...
52,879,261
I have a spring boot application and i am trying to implement the spring security to override the default username and password generated by spring .but its not working. spring still using the default user credentials. ``` @EnableWebSecurity @Configuration public class WebSecurityConfigurtion extends WebSecurityConfig...
2018/10/18
[ "https://Stackoverflow.com/questions/52879261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10525271/" ]
This can be done using following properties on `application.properties` or `application.yaml` file. ``` spring.security.user.name spring.security.user.password spring.security.user.roles ``` Take a look at [this.](https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html)
Issue fixed by adding the config package where the security classes are availble into the component scanning of the main class.
52,879,261
I have a spring boot application and i am trying to implement the spring security to override the default username and password generated by spring .but its not working. spring still using the default user credentials. ``` @EnableWebSecurity @Configuration public class WebSecurityConfigurtion extends WebSecurityConfig...
2018/10/18
[ "https://Stackoverflow.com/questions/52879261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10525271/" ]
In your application.properties file add this code `spring.security.user.name = root` -- this is your username `spring.security.user.password = root` -- this is your password `spring.security.user.roles = user` --this is your role
Issue fixed by adding the config package where the security classes are availble into the component scanning of the main class.
52,879,261
I have a spring boot application and i am trying to implement the spring security to override the default username and password generated by spring .but its not working. spring still using the default user credentials. ``` @EnableWebSecurity @Configuration public class WebSecurityConfigurtion extends WebSecurityConfig...
2018/10/18
[ "https://Stackoverflow.com/questions/52879261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10525271/" ]
You need to register a UserDetailsService bean. In this case, just expose the InMemoryUserDetailsManager as a bean in your WebSecurityConfiguration.class, like this: ```java // expose the UserDetailsService as a bean @Bean @Override public UserDetailsService userDetailsServiceBean() throws Exception {...
Issue fixed by adding the config package where the security classes are availble into the component scanning of the main class.
26,374,866
I'm using the [Unirest library](http://unirest.io/python.html) for making async web requests with Python. I've read the documentation, but I wasn't able to find if I can use proxy with it. Maybe I'm just blind and there's a way to use it with Unirest? Or is there some other way to specify proxy for Python? Proxies sh...
2014/10/15
[ "https://Stackoverflow.com/questions/26374866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2298183/" ]
I know nothing about Unirest, but, In all the scripts I wrote that requierd proxy support I used SocksiPy (<http://socksipy.sourceforge.net>) module. It support HTTP, SOCKS4 and SOCKS5 and it s really easy to use. :)
Would something like this work for you? [1] <https://github.com/obriencj/python-promises>
23,543,202
While reviewing the system library `socket.py` implementation I came across this code ``` try: import errno except ImportError: errno = None EBADF = getattr(errno, 'EBADF', 9) EINTR = getattr(errno, 'EINTR', 4) ``` Is this code just a relic of a bygone age, or there are platforms/implementations out there fo...
2014/05/08
[ "https://Stackoverflow.com/questions/23543202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1499402/" ]
The reason this might be a bit tricky is because the parent nodes have some set defaults. Set width and height to 100% in initialization of `Reveal`: ``` Reveal.initialize({ width: "100%", height:"100%" }); ``` Ensure that the slide (ie. `section`) uses the whole space: ``` .full { height:100%; wi...
Can you provide an example of the HTML that has the class `.reveal`? Add `position:absolute` to your selector rule. If you want the caption to sit flush at the bottom corner of each slide, it's best to set the position to `bottom:0px` instead of `top`. For example: ``` <style type="text/css"> .reveal .reveal_sectio...
34,624,964
I want to extract certain information from the output of a program. But my method does not work. I write a rather simple script. ``` #!/usr/bin/env python print "first hello world." print "second" ``` After making the script executable, I type `./test | grep "first|second"`. I expect it to show the two sentences. B...
2016/01/06
[ "https://Stackoverflow.com/questions/34624964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5719744/" ]
Having researched this myself just now, it looks as though the Meteor version 1.4 release will be updated to version 3.2 of MongoDB, in which "*32-bit binaries are deprecated*" * [Github ticket for the updating of MongoDB](https://github.com/meteor/meteor/issues/6957) * [MongoDB declaration that 3.2 has deprecated 32-...
I guess you didn't install the right version of Mongo if you have a 32 bits version. check out their installation guide: <https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/> First download the right 64 bits version for Windows: <https://www.mongodb.org/downloads#production> and follow the instructi...
8,070,186
Is there a way with the boto python API to specify tags when creating an instance? I'm trying to avoid having to create an instance, fetch it and then add tags. It would be much easier to have the instance either pre-configured to have certain tags or to specify tags when I execute the following command: ``` ec2server...
2011/11/09
[ "https://Stackoverflow.com/questions/8070186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/301816/" ]
This answer was accurate at the time it was written but is now out of date. The AWS API's and Libraries (such as boto3) can now take a "TagSpecification" parameter that allows you to specify tags when running the "create\_instances" call. --- Tags cannot be made until the instance has been created. Even though the fu...
This method has worked for me: ``` rsvn = image.run( ... standard options ... ) sleep(1) for instance in rsvn.instances: instance.add_tag('<tag name>', <tag value>) ```
8,070,186
Is there a way with the boto python API to specify tags when creating an instance? I'm trying to avoid having to create an instance, fetch it and then add tags. It would be much easier to have the instance either pre-configured to have certain tags or to specify tags when I execute the following command: ``` ec2server...
2011/11/09
[ "https://Stackoverflow.com/questions/8070186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/301816/" ]
Using boto 2.9.6, I'm able to add tags to an instance immediately after getting my response back from run\_instances. Something like this works without sleep: ``` reservation = my_connection.run_instances(...) for instance in reservation.instances: instance.add_tag('Name', <whatever>) ``` I verified that the ins...
This method has worked for me: ``` rsvn = image.run( ... standard options ... ) sleep(1) for instance in rsvn.instances: instance.add_tag('<tag name>', <tag value>) ```
8,070,186
Is there a way with the boto python API to specify tags when creating an instance? I'm trying to avoid having to create an instance, fetch it and then add tags. It would be much easier to have the instance either pre-configured to have certain tags or to specify tags when I execute the following command: ``` ec2server...
2011/11/09
[ "https://Stackoverflow.com/questions/8070186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/301816/" ]
[You can tag instance or volume on creation](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TagSpecification.html) From [run\_instances docs](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html): > > You can tag instances and EBS volumes during launch, after launch, or both. For mo...
This method has worked for me: ``` rsvn = image.run( ... standard options ... ) sleep(1) for instance in rsvn.instances: instance.add_tag('<tag name>', <tag value>) ```
8,070,186
Is there a way with the boto python API to specify tags when creating an instance? I'm trying to avoid having to create an instance, fetch it and then add tags. It would be much easier to have the instance either pre-configured to have certain tags or to specify tags when I execute the following command: ``` ec2server...
2011/11/09
[ "https://Stackoverflow.com/questions/8070186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/301816/" ]
This answer was accurate at the time it was written but is now out of date. The AWS API's and Libraries (such as boto3) can now take a "TagSpecification" parameter that allows you to specify tags when running the "create\_instances" call. --- Tags cannot be made until the instance has been created. Even though the fu...
Using boto 2.9.6, I'm able to add tags to an instance immediately after getting my response back from run\_instances. Something like this works without sleep: ``` reservation = my_connection.run_instances(...) for instance in reservation.instances: instance.add_tag('Name', <whatever>) ``` I verified that the ins...
8,070,186
Is there a way with the boto python API to specify tags when creating an instance? I'm trying to avoid having to create an instance, fetch it and then add tags. It would be much easier to have the instance either pre-configured to have certain tags or to specify tags when I execute the following command: ``` ec2server...
2011/11/09
[ "https://Stackoverflow.com/questions/8070186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/301816/" ]
This answer was accurate at the time it was written but is now out of date. The AWS API's and Libraries (such as boto3) can now take a "TagSpecification" parameter that allows you to specify tags when running the "create\_instances" call. --- Tags cannot be made until the instance has been created. Even though the fu...
[You can tag instance or volume on creation](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TagSpecification.html) From [run\_instances docs](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html): > > You can tag instances and EBS volumes during launch, after launch, or both. For mo...
8,070,186
Is there a way with the boto python API to specify tags when creating an instance? I'm trying to avoid having to create an instance, fetch it and then add tags. It would be much easier to have the instance either pre-configured to have certain tags or to specify tags when I execute the following command: ``` ec2server...
2011/11/09
[ "https://Stackoverflow.com/questions/8070186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/301816/" ]
[You can tag instance or volume on creation](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TagSpecification.html) From [run\_instances docs](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html): > > You can tag instances and EBS volumes during launch, after launch, or both. For mo...
Using boto 2.9.6, I'm able to add tags to an instance immediately after getting my response back from run\_instances. Something like this works without sleep: ``` reservation = my_connection.run_instances(...) for instance in reservation.instances: instance.add_tag('Name', <whatever>) ``` I verified that the ins...
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
Are you trying download this from Github? Especially on Google Chrome browsers, I've had issues download .ipynb files using right click > **Save link as...** I'm not sure if other browsers have this issue (Microsoft Edge, Mozilla Firefox, Safari, etc.). This causes issues since when downloading, it doesn't completely ...
I opened it as/with nbviewer and then selected it all and saved it as a "txt" file that I then opened in Notepad++. I then resaved it as a file with the extension ipynb and opened it in my jupyter notebook ok.
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
On the Mac you could go and 1. Right click on the `filename.ipynb.json` 2. Click on `Get Info` from the list. 3. From the `Get Info` window, find the section `Name&Extension` remove the extension/suffix `.json` from the file name. Hope that helps!
Are you trying download this from Github? Especially on Google Chrome browsers, I've had issues download .ipynb files using right click > **Save link as...** I'm not sure if other browsers have this issue (Microsoft Edge, Mozilla Firefox, Safari, etc.). This causes issues since when downloading, it doesn't completely ...
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
My Solution: just remove the filename extension **.json**. for example, change **myfile.ipynb.json** to **myfile.ipynb**. Then, you can open it by a click in jupyter notebook ! I have encounter the same problem as you did. I found a link that describe what ipynb exactly is. see here <http://ipython.org/ipython-doc/rel...
The easy thing to do is to copy the JSON contents into a notepad and save it again with .ipynb extension
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
Are you trying download this from Github? Especially on Google Chrome browsers, I've had issues download .ipynb files using right click > **Save link as...** I'm not sure if other browsers have this issue (Microsoft Edge, Mozilla Firefox, Safari, etc.). This causes issues since when downloading, it doesn't completely ...
i tried this method and it worked. Just copy, paste it in notepad and save as "file\_name.ipynb". hope this works for you too.
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
On the Mac you could go and 1. Right click on the `filename.ipynb.json` 2. Click on `Get Info` from the list. 3. From the `Get Info` window, find the section `Name&Extension` remove the extension/suffix `.json` from the file name. Hope that helps!
Just remove the `.json` file extension leaving the `.ipynb` one, as pointed out by the following related post: <https://superuser.com/questions/1497243/why-cant-i-save-a-jupyter-notebook-as-a-ipynb>. As @jackie already said, you should consider them as `.json` files meant only to be edited by the IPython Notebook app i...
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
My Solution: just remove the filename extension **.json**. for example, change **myfile.ipynb.json** to **myfile.ipynb**. Then, you can open it by a click in jupyter notebook ! I have encounter the same problem as you did. I found a link that describe what ipynb exactly is. see here <http://ipython.org/ipython-doc/rel...
Just remove the `.json` file extension leaving the `.ipynb` one, as pointed out by the following related post: <https://superuser.com/questions/1497243/why-cant-i-save-a-jupyter-notebook-as-a-ipynb>. As @jackie already said, you should consider them as `.json` files meant only to be edited by the IPython Notebook app i...
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
My Solution: just remove the filename extension **.json**. for example, change **myfile.ipynb.json** to **myfile.ipynb**. Then, you can open it by a click in jupyter notebook ! I have encounter the same problem as you did. I found a link that describe what ipynb exactly is. see here <http://ipython.org/ipython-doc/rel...
After downloading the file with ipynb.json, Take the following steps: 1. Go your terminal/command line window 2. Navigate to the directory where your file is 3. Type: windows OS: rename yourfile.ipynb.json to yourfile.ipynb Unix/Linux: mv yourfile.ipynb.json to yourfile.ipynb This work perfectly for me.
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
My Solution: just remove the filename extension **.json**. for example, change **myfile.ipynb.json** to **myfile.ipynb**. Then, you can open it by a click in jupyter notebook ! I have encounter the same problem as you did. I found a link that describe what ipynb exactly is. see here <http://ipython.org/ipython-doc/rel...
Are you trying download this from Github? Especially on Google Chrome browsers, I've had issues download .ipynb files using right click > **Save link as...** I'm not sure if other browsers have this issue (Microsoft Edge, Mozilla Firefox, Safari, etc.). This causes issues since when downloading, it doesn't completely ...
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
Use a simple trick. Let that file get downloaded automatically. Re-download it again then it will prompt you to download and replace that file. At that time, you save that by replacing .json to .ipynb
i tried this method and it worked. Just copy, paste it in notepad and save as "file\_name.ipynb". hope this works for you too.
41,231,632
I am taking a course that uses ipython notebook. When I try to download the notebook (through File -> Download as -> ipython notebook), I get a file that ends with ".ipynb.json". It doesn't open as an ipython notebook but as a .json file so something like this: ``` { "cells": [ { "cell_type": "markdown", "met...
2016/12/19
[ "https://Stackoverflow.com/questions/41231632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6841599/" ]
I opened it as/with nbviewer and then selected it all and saved it as a "txt" file that I then opened in Notepad++. I then resaved it as a file with the extension ipynb and opened it in my jupyter notebook ok.
The easy thing to do is to copy the JSON contents into a notepad and save it again with .ipynb extension
49,737,148
I am trying to create a CNN model in Keras with multiple conv3d to work on cifar10 dataset. But facing the following issue: > > ValueError: ('The specified size contains a dimension with value <= > 0', (-8000, 256)) > > > Below is my code that I am trying to execute. ```python from __future__ import print_funct...
2018/04/09
[ "https://Stackoverflow.com/questions/49737148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2511239/" ]
What do you gain by putting this string in your scenario. IMO all you are doing is making the scenario harder to read! What do you lose by putting this string in your scenario? Well first of all you now have to have at least two things the determine the exact contents of the string, the thing in the application that ...
Try with a datatable approach. You will have to add a `DataTable` argument in the stepdefinition. ``` Then Drop-dow patient_breed contains 'Breed1' 'Breed2' ... ... ... 'Breed20'] ``` For a multiline approach try the below. In this you will have to add a `String` argument to the stepdefinition. ``` Then Drop-dow pa...
49,737,148
I am trying to create a CNN model in Keras with multiple conv3d to work on cifar10 dataset. But facing the following issue: > > ValueError: ('The specified size contains a dimension with value <= > 0', (-8000, 256)) > > > Below is my code that I am trying to execute. ```python from __future__ import print_funct...
2018/04/09
[ "https://Stackoverflow.com/questions/49737148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2511239/" ]
What do you gain by putting this string in your scenario. IMO all you are doing is making the scenario harder to read! What do you lose by putting this string in your scenario? Well first of all you now have to have at least two things the determine the exact contents of the string, the thing in the application that ...
I would read the entire string and then split it using Java after it has been passed into the step. In order to keep my step as a one or two liner, I would use a helper method that I implemented myself.
2,460,407
I want to develop a anonymous chat website like <http://omgele.com>. I know that this website is developed in python using `twisted matrix` framework. Using twisted matrix it's easy to develop such website. But I am very comfortable in Java and have 1 year's experience with it, and dont know python. 1. What should I d...
2010/03/17
[ "https://Stackoverflow.com/questions/2460407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291241/" ]
*I would politely ask the people at omgele.com for a copy of their code and study it to* 1. learn Python and twisted matrix 2. decide to use it or if I decide against it, to apply what I learned from them to write my own Java site unfortunately, the source code is not likely to be available.. Still I advise to lea...
Learning Python can be an informative, interesting, and valuable process. When you really get going, you will probably find you can develop more rapidly than in Java. Twisted is an fairly well-executed framework which lets you avoid many of the pitfalls you can run into with asynchronous IO; it has top-notch implementa...
2,460,407
I want to develop a anonymous chat website like <http://omgele.com>. I know that this website is developed in python using `twisted matrix` framework. Using twisted matrix it's easy to develop such website. But I am very comfortable in Java and have 1 year's experience with it, and dont know python. 1. What should I d...
2010/03/17
[ "https://Stackoverflow.com/questions/2460407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291241/" ]
Learn python. This will add one very powerful tool to your toolbox. Also twisted can do much more than just chat which will help you in future.
*I would politely ask the people at omgele.com for a copy of their code and study it to* 1. learn Python and twisted matrix 2. decide to use it or if I decide against it, to apply what I learned from them to write my own Java site unfortunately, the source code is not likely to be available.. Still I advise to lea...
2,460,407
I want to develop a anonymous chat website like <http://omgele.com>. I know that this website is developed in python using `twisted matrix` framework. Using twisted matrix it's easy to develop such website. But I am very comfortable in Java and have 1 year's experience with it, and dont know python. 1. What should I d...
2010/03/17
[ "https://Stackoverflow.com/questions/2460407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291241/" ]
*I would politely ask the people at omgele.com for a copy of their code and study it to* 1. learn Python and twisted matrix 2. decide to use it or if I decide against it, to apply what I learned from them to write my own Java site unfortunately, the source code is not likely to be available.. Still I advise to lea...
I've worked with about a dozen different languages, and started with Python about two months ago. Java and Python in developing web apps, middleware, and services ROCKS!! Learn Python.
2,460,407
I want to develop a anonymous chat website like <http://omgele.com>. I know that this website is developed in python using `twisted matrix` framework. Using twisted matrix it's easy to develop such website. But I am very comfortable in Java and have 1 year's experience with it, and dont know python. 1. What should I d...
2010/03/17
[ "https://Stackoverflow.com/questions/2460407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291241/" ]
Learn python. This will add one very powerful tool to your toolbox. Also twisted can do much more than just chat which will help you in future.
Learning Python can be an informative, interesting, and valuable process. When you really get going, you will probably find you can develop more rapidly than in Java. Twisted is an fairly well-executed framework which lets you avoid many of the pitfalls you can run into with asynchronous IO; it has top-notch implementa...
2,460,407
I want to develop a anonymous chat website like <http://omgele.com>. I know that this website is developed in python using `twisted matrix` framework. Using twisted matrix it's easy to develop such website. But I am very comfortable in Java and have 1 year's experience with it, and dont know python. 1. What should I d...
2010/03/17
[ "https://Stackoverflow.com/questions/2460407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291241/" ]
To your #2 question, take a look at Jabber (XMPP), it has several Java clients and is widely supported. Example Gtalk, Facebook use XMPP. [Here](http://www.igniterealtime.org/projects/openfire/) is an excellent server written in Java.
Learning Python can be an informative, interesting, and valuable process. When you really get going, you will probably find you can develop more rapidly than in Java. Twisted is an fairly well-executed framework which lets you avoid many of the pitfalls you can run into with asynchronous IO; it has top-notch implementa...
2,460,407
I want to develop a anonymous chat website like <http://omgele.com>. I know that this website is developed in python using `twisted matrix` framework. Using twisted matrix it's easy to develop such website. But I am very comfortable in Java and have 1 year's experience with it, and dont know python. 1. What should I d...
2010/03/17
[ "https://Stackoverflow.com/questions/2460407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291241/" ]
Learn python. This will add one very powerful tool to your toolbox. Also twisted can do much more than just chat which will help you in future.
To your #2 question, take a look at Jabber (XMPP), it has several Java clients and is widely supported. Example Gtalk, Facebook use XMPP. [Here](http://www.igniterealtime.org/projects/openfire/) is an excellent server written in Java.
2,460,407
I want to develop a anonymous chat website like <http://omgele.com>. I know that this website is developed in python using `twisted matrix` framework. Using twisted matrix it's easy to develop such website. But I am very comfortable in Java and have 1 year's experience with it, and dont know python. 1. What should I d...
2010/03/17
[ "https://Stackoverflow.com/questions/2460407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291241/" ]
Learn python. This will add one very powerful tool to your toolbox. Also twisted can do much more than just chat which will help you in future.
I've worked with about a dozen different languages, and started with Python about two months ago. Java and Python in developing web apps, middleware, and services ROCKS!! Learn Python.
2,460,407
I want to develop a anonymous chat website like <http://omgele.com>. I know that this website is developed in python using `twisted matrix` framework. Using twisted matrix it's easy to develop such website. But I am very comfortable in Java and have 1 year's experience with it, and dont know python. 1. What should I d...
2010/03/17
[ "https://Stackoverflow.com/questions/2460407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/291241/" ]
To your #2 question, take a look at Jabber (XMPP), it has several Java clients and is widely supported. Example Gtalk, Facebook use XMPP. [Here](http://www.igniterealtime.org/projects/openfire/) is an excellent server written in Java.
I've worked with about a dozen different languages, and started with Python about two months ago. Java and Python in developing web apps, middleware, and services ROCKS!! Learn Python.
12,142,174
I want to call a Python script from C, passing some arguments that are needed in the script. The script I want to use is mrsync, or [multicast remote sync](http://sourceforge.net/projects/mrsync/). I got this working from command line, by calling: ``` python mrsync.py -m /tmp/targets.list -s /tmp/sourcedata -t /tmp/t...
2012/08/27
[ "https://Stackoverflow.com/questions/12142174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/960585/" ]
Seems like you're looking for an answer using the python development APIs from Python.h. Here's an example for you that should work: ``` #My python script called mypy.py import sys if len(sys.argv) != 2: sys.exit("Not enough args") ca_one = str(sys.argv[1]) ca_two = str(sys.argv[2]) print "My command line args are...
You have two options. 1. Call ``` system("python mrsync.py -m /tmp/targets.list -s /tmp/sourcedata -t /tmp/targetdata") ``` in your C code. 2. Actually use the API that `mrsync` (hopefully) defines. This is more flexible, but much more complicated. The first step would be to work out how you would perform the above...
20,412,091
I am trying to make this 2 n body diagram to work in vpython, it seems that is working but something is wrong with my center or mass, or something, i don't really know. The 2 n body system is shifting and is not staying still. ``` from visual import* mt= 1.99e30 #Kg G=6.67e-11 #N*(m/kg)^2 #Binary System stars StarA...
2013/12/05
[ "https://Stackoverflow.com/questions/20412091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2839580/" ]
Two points I'd like to make about your problem: 1. You're using Euler's method of integration. That is the "i.velocity = i.velocity + i.acceleration\*dt" part of your code. This method is not very accurate, especially with oscillatory problems like this one. That's part of the reason you're noticing the drift in your ...
This is wrong: ``` for each in objects: Xcm=Xcm/TotalMass ... ``` This division should only happen once. And then the averages should be removed from the objects, as in ``` Xcm=Xcm/TotalMass ... for each in objects: each.pos.x -= Xcm ... ```
28,550,511
I am trying to learn how to use callbacks between C and Python by way of Cython and have been looking at [this demo](https://github.com/cython/cython/tree/master/Demos/callback). I would like a Python function applied to one std::vector/numpy.array and store the results in another. I can compile and run without errors,...
2015/02/16
[ "https://Stackoverflow.com/questions/28550511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2308288/" ]
Thanks, Ian. Based on your suggestion, I changed the code to return a vector instead of trying to modify it in place. This works, although is admittedly not particularly efficient callback.hpp ``` typedef double (*Callback)( void *apply, double x ); vector<double> function( Callback callback, void *apply, ...
There is an implicit copy of the array made when you cast it to be a vector. There isn't currently any way to have a vector take ownership of memory that has already been allocated, so the only workaround will be to copy the values manually or by exposing `std::copy` to cython. See [How to cheaply assign C-style array ...
67,798,070
I am more or less following [this example](http://4/1AY0e-g4pMh6JPfkexh5nvWf9lvug3sHK98_jxAnwhsYlrB3F20Jkp350PKY) to integrate the ray tune hyperparameter library with the huggingface transformers library using my own dataset. Here is my script: ``` import ray from ray import tune from ray.tune import CLIReporter fro...
2021/06/02
[ "https://Stackoverflow.com/questions/67798070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7254514/" ]
I had the same error when trying to use pickle.dump(), for me it worked to downgrade pickle5 from version 0.0.11 to 0.0.10
Not a "real" solution but at least a workaround. For me this issue was occurring on Python 3.7. Switching to Python 3.8 solved the issue.
67,798,070
I am more or less following [this example](http://4/1AY0e-g4pMh6JPfkexh5nvWf9lvug3sHK98_jxAnwhsYlrB3F20Jkp350PKY) to integrate the ray tune hyperparameter library with the huggingface transformers library using my own dataset. Here is my script: ``` import ray from ray import tune from ray.tune import CLIReporter fro...
2021/06/02
[ "https://Stackoverflow.com/questions/67798070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7254514/" ]
I also encountered this error on Google Colab trying ray tune hyperparameter search with the huggingface transformers. This helped me: ``` !pip install pickle5 ``` Then ``` import pickle5 as pickle ``` After the first run there will be the pickle warning to restart the notebook and the same error. After the seco...
Not a "real" solution but at least a workaround. For me this issue was occurring on Python 3.7. Switching to Python 3.8 solved the issue.
66,559,058
I would like to convert a string `temp.filename.txt` to `temp\.filename\.txt` using python Tried string replace method but the output is not as expected ``` filename = "temp.filename.txt" filename.replace(".", "\.") output: 'temp\\.filename\\.txt' ```
2021/03/10
[ "https://Stackoverflow.com/questions/66559058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3572886/" ]
`\` is a special character, which is *represented* as `\\`, this doesn't mean your string actually contains 2 `\` characters. (as suggested by @saipy, if you *print* your string, only single `\` should show up...)
``` filename = "temp.filename.txt" result=filename.replace(".", "\.") print(result) ``` [I stored a result in variable(result) its working fine check this](https://i.stack.imgur.com/klc8N.png)
57,379,888
The Source Code --------------- I have a bit of code requiring that I call a property setter to test wether or not locking functionaliy of a class is working (some functions of the class are `async`, requiring that a padlock boolean be set during their execution). The setter has been written to raise a `RuntimeError` ...
2019/08/06
[ "https://Stackoverflow.com/questions/57379888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7423333/" ]
You need to actually *invoke* the setter, via an assignment. This is simple to do, as long as you use `assertRaises` as a context manager. ``` with self.assertRaises(RuntimeError): my_object.filename = "testfile.txt" ``` --- If you couldn't do that, you would have to fall back to an explicit `try` statement (wh...
You can use the `setattr` method like so: ``` self.assertRaises(ValueError, setattr, p, "name", None) ``` In the above example, we will try to set `p.name` equal to `None` and check if there is a `ValueError` raised.
13,212,300
I don't know if this question has duplicates , but i haven't found one yet. when using python you can create GUI fastly , but sometimes you cannot find a method to do what you want. for example i have the following problem: let's suppose that there is a canvas called K with a rectangle with ID=1(canvas item id , not ...
2012/11/03
[ "https://Stackoverflow.com/questions/13212300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1569222/" ]
You can use [`Canvas.itemconfig`](https://web.archive.org/web/20201108093851id_/http://effbot.org/tkinterbook/canvas.htm#Tkinter.Canvas.itemconfig-method): ``` item = K.create_rectangle(x1,y1,x2,y2,options...) K.itemconfig(item,options) ``` To move the item, you can use [`Canvas.move`](https://web.archive.org/web/20...
I searched around and found the perfect Tkinter method for resizing. canvas.coords() does the trick. just feed it your new coordinates and it's "good to go". Python 3.4 PS. don't forget the first param is the id.
4,156,464
I need to parse a series of short strings that are comprised of 3 parts: a question and 2 possible answers. The string will follow a consistent format: This is the question "answer\_option\_1 is in quotes" "answer\_option\_2 is in quotes" I need to identify the question part and the two possible answer choices that ...
2010/11/11
[ "https://Stackoverflow.com/questions/4156464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/504732/" ]
``` >>> import re >>> s = "Who will win the game 'Michigan' 'Ohio State'" >>> re.match(r'(.+)\s+([\'"])(.+?)\2\s+([\'"])(.+?)\4', s).groups() ('Who will win the game', "'", 'Michigan', "'", 'Ohio State') ```
One possibility is that you can use regex. ``` import re robj = re.compile(r'^(.*) [\"\'](.*)[\"\'].*[\"\'](.*)[\"\']') str1 = "Who will win the game 'Michigan' 'Ohio State'" r1 = robj.match(str1) print r1.groups() str2 = 'What color is the sky today? "blue" or "grey"' r2 = robj.match(str2) r2.groups() ``` Output: ...
4,156,464
I need to parse a series of short strings that are comprised of 3 parts: a question and 2 possible answers. The string will follow a consistent format: This is the question "answer\_option\_1 is in quotes" "answer\_option\_2 is in quotes" I need to identify the question part and the two possible answer choices that ...
2010/11/11
[ "https://Stackoverflow.com/questions/4156464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/504732/" ]
If your format is a simple as you say (i.e. *not* as in your examples), you don't need regex. Just `split` the line: ``` >>> line = 'What color is the sky today? "blue" "grey"'.strip('"') >>> questions, answers = line.split('"', 1) >>> answer1, answer2 = answers.split('" "') >>> questions 'What color is the sky today?...
One possibility is that you can use regex. ``` import re robj = re.compile(r'^(.*) [\"\'](.*)[\"\'].*[\"\'](.*)[\"\']') str1 = "Who will win the game 'Michigan' 'Ohio State'" r1 = robj.match(str1) print r1.groups() str2 = 'What color is the sky today? "blue" or "grey"' r2 = robj.match(str2) r2.groups() ``` Output: ...
4,156,464
I need to parse a series of short strings that are comprised of 3 parts: a question and 2 possible answers. The string will follow a consistent format: This is the question "answer\_option\_1 is in quotes" "answer\_option\_2 is in quotes" I need to identify the question part and the two possible answer choices that ...
2010/11/11
[ "https://Stackoverflow.com/questions/4156464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/504732/" ]
``` >>> import re >>> s = "Who will win the game 'Michigan' 'Ohio State'" >>> re.match(r'(.+)\s+([\'"])(.+?)\2\s+([\'"])(.+?)\4', s).groups() ('Who will win the game', "'", 'Michigan', "'", 'Ohio State') ```
Pyparsing will give you a solution that will adapt to some variability in the input text: ``` questions = """\ What color is the sky today? "blue" or "grey" Who will win the game 'Michigan' 'Ohio State'""".splitlines() from pyparsing import * quotedString.setParseAction(removeQuotes) q_and_a = SkipTo(quotedString)("...
4,156,464
I need to parse a series of short strings that are comprised of 3 parts: a question and 2 possible answers. The string will follow a consistent format: This is the question "answer\_option\_1 is in quotes" "answer\_option\_2 is in quotes" I need to identify the question part and the two possible answer choices that ...
2010/11/11
[ "https://Stackoverflow.com/questions/4156464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/504732/" ]
If your format is a simple as you say (i.e. *not* as in your examples), you don't need regex. Just `split` the line: ``` >>> line = 'What color is the sky today? "blue" "grey"'.strip('"') >>> questions, answers = line.split('"', 1) >>> answer1, answer2 = answers.split('" "') >>> questions 'What color is the sky today?...
Pyparsing will give you a solution that will adapt to some variability in the input text: ``` questions = """\ What color is the sky today? "blue" or "grey" Who will win the game 'Michigan' 'Ohio State'""".splitlines() from pyparsing import * quotedString.setParseAction(removeQuotes) q_and_a = SkipTo(quotedString)("...
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
I found [this page](https://support.anaconda.com/customer/en/portal/articles/2797011-updating-anaconda-to-python-3-6) with detailed instructions to upgrade Anaconda to a major newer version of Python (from Anaconda 4.0+). First, ``` conda update conda conda remove argcomplete conda-manager ``` I also had to `conda r...
Only solution that works was create a new conda env with the name you want (you will, unfortunately, delete the old one to keep the name). Then create a new env with a new python version and re-run your `install.sh` script with the conda/pip installs (or the yaml file or whatever you use to keep your requirements): ``...
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
In the past, I have found it quite difficult to try to upgrade in-place. Note: my use-case for Anaconda is as an all-in-one Python environment. I don't bother with separate virtual environments. If you're using `conda` to create environments, this may be destructive because `conda` creates environments with hard-link...
This is how I mange to get (as currently there is no direct support- in future it will be for sure) python 3.9 in anaconda and windows 10 **Note:** I needed extra packages so install them, install only what you need ``` conda create --name e39 python=3.9 --channel conda-forge ``` **Update** Python 3.9 is availab...
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
Only solution that works was create a new conda env with the name you want (you will, unfortunately, delete the old one to keep the name). Then create a new env with a new python version and re-run your `install.sh` script with the conda/pip installs (or the yaml file or whatever you use to keep your requirements): ``...
1. Open Anaconda Powershell Prompt with **administrator user.** 2. Type in `conda update python`. 3. Wait about 10 min, in this process you may need to type in `y` in some time. 4. After completing, check your python version in conda by typing `python --version` 5. If it is the newest version, then you can restart your...
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
I found [this page](https://support.anaconda.com/customer/en/portal/articles/2797011-updating-anaconda-to-python-3-6) with detailed instructions to upgrade Anaconda to a major newer version of Python (from Anaconda 4.0+). First, ``` conda update conda conda remove argcomplete conda-manager ``` I also had to `conda r...
This is how I mange to get (as currently there is no direct support- in future it will be for sure) python 3.9 in anaconda and windows 10 **Note:** I needed extra packages so install them, install only what you need ``` conda create --name e39 python=3.9 --channel conda-forge ``` **Update** Python 3.9 is availab...
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
If you want to upgrade the Python version inside your existing environment, activate it first with `conda activate <env_name>` and then do: ``` conda install -c anaconda python=<version> ``` You might also need to update the dependencies with ``` conda update --all ```
Best method I found: ``` source activate old_env conda env export > old_env.yml ``` Then process it with something like this: ``` with open('old_env.yml', 'r') as fin, open('new_env.yml', 'w') as fout: for line in fin: if 'py35' in line: # replace by the version you want to supersede line =...
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
Anaconda has not updated python internally to 3.6. a) Method 1 1. If you wanted to update you will type `conda update python` 2. To update anaconda type `conda update conda` 3. If you want to upgrade between major python version like 3.5 to 3.6, you'll have to do ``` conda install python=$pythonversion$ ``` b) Met...
Only solution that works was create a new conda env with the name you want (you will, unfortunately, delete the old one to keep the name). Then create a new env with a new python version and re-run your `install.sh` script with the conda/pip installs (or the yaml file or whatever you use to keep your requirements): ``...
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
I found [this page](https://support.anaconda.com/customer/en/portal/articles/2797011-updating-anaconda-to-python-3-6) with detailed instructions to upgrade Anaconda to a major newer version of Python (from Anaconda 4.0+). First, ``` conda update conda conda remove argcomplete conda-manager ``` I also had to `conda r...
If you want to upgrade the Python version inside your existing environment, activate it first with `conda activate <env_name>` and then do: ``` conda install -c anaconda python=<version> ``` You might also need to update the dependencies with ``` conda update --all ```
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
I found [this page](https://support.anaconda.com/customer/en/portal/articles/2797011-updating-anaconda-to-python-3-6) with detailed instructions to upgrade Anaconda to a major newer version of Python (from Anaconda 4.0+). First, ``` conda update conda conda remove argcomplete conda-manager ``` I also had to `conda r...
I'm using a **Mac OS Mojave** These 4 steps worked for me. 1. `conda update conda` 2. `conda install python=3.6` 3. `conda install anaconda-client` 4. `conda update anaconda`
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
I'm using a **Mac OS Mojave** These 4 steps worked for me. 1. `conda update conda` 2. `conda install python=3.6` 3. `conda install anaconda-client` 4. `conda update anaconda`
If you want to upgrade the Python version inside your existing environment, activate it first with `conda activate <env_name>` and then do: ``` conda install -c anaconda python=<version> ``` You might also need to update the dependencies with ``` conda update --all ```
41,535,881
I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (`python -V`): ``` Python 3.5.2 :: Anaconda 4.2.0 (x86_64) ``` How would I upgrade to Python 3.6?
2017/01/08
[ "https://Stackoverflow.com/questions/41535881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4343241/" ]
If you want to upgrade the Python version inside your existing environment, activate it first with `conda activate <env_name>` and then do: ``` conda install -c anaconda python=<version> ``` You might also need to update the dependencies with ``` conda update --all ```
This is how I mange to get (as currently there is no direct support- in future it will be for sure) python 3.9 in anaconda and windows 10 **Note:** I needed extra packages so install them, install only what you need ``` conda create --name e39 python=3.9 --channel conda-forge ``` **Update** Python 3.9 is availab...
42,549,482
Here is the pseudo code: ``` class Foo (list): def methods... foo=Foo() foo.readin() rule='....' bar=[for x in foo if x.match(rule)] ``` Here, bar is of a list, however I'd like it to be a instance of Foo, The only way I know is to create a for loop and append items one by one: ``` bar=Foo() for item in foo:...
2017/03/02
[ "https://Stackoverflow.com/questions/42549482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4250879/" ]
You can pass in a [generator expression](https://docs.python.org/3/tutorial/classes.html#generator-expressions) to the `Foo()` call: ``` bar = Foo(x for x in foo if x.match(rule)) ``` (When passing a generator expression to a call, where it is the only argument, you can drop the parentheses you normally would put ar...
It seems another answer got deleted because the original answerer deleted it. So I post the other way here for completeness. If the origin answerer restore he's answer I will delete this answer myself. another way to do this is to use the build in filter function. the code is : ``` bar=filter( lambda x: x.match(rule)...
51,011,204
I have a 1D array X with both +/- elements. I'm isolating their signs as follows: ``` idxN, idxP = X<0, X>=0 ``` Now I want to create an array whose value depends on the sign of X. I was trying to compute this but it gives the captioned syntax error. ``` y(idxN) = [math.log(1+np.exp(x)) for x in X(idxN)] y(idxP) =...
2018/06/24
[ "https://Stackoverflow.com/questions/51011204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9473446/" ]
In some programming languages like Matlab, indexes are references with parentheses. In Python, indexes are represented with square brackets. If I have a list, `mylist = [1,2,3,4]`, I reference elements like this: ``` > mylist[1] 2 ``` Wen you say `y(idxN)`, Python thinks you are trying to pass `idxN` as an argume...
I got it to work like this: ``` y = np.zeros(X.shape) idxN, idxP = X<0, X>=0 yn,yp,xn,xp = y[idxN], y[idxP],X[idxN],X[idxP] yn = [math.log(1+np.exp(x)) for x in xn] yp = xp+[math.log(np.exp(-x)+1) for x in xp]; ``` If there is a better way, please let me know. Thanks.
13,283,628
I have created a mezzanine project and its name is mezzanine-heroku-test I create a Procfile that has the content as follow: **web: python manage.py run\_gunicorn -b "0.0.0.0:$PORT" -w 3** Next, I access to the website to test and I receive the error: Internal Server Error. So, Could you please help me deploy mezzani...
2012/11/08
[ "https://Stackoverflow.com/questions/13283628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/875781/" ]
Two possibilities: 1. There is a table within another schema ("database" in mysql terminology) which has a FK reference 2. The innodb internal data dictionary is out of sync with the mysql one. You can see which table it was (one of them, anyway) by doing a "SHOW ENGINE INNODB STATUS" after the drop fails. If it tur...
Instead of using default innodb storage engine you can easily configure django to use MyISAM. In the later case, it wouldn't restrict you from performing various operation because of the relationships. Both have their positive and negative points.
39,961,414
I am new to learning regex in python and I'm wondering how do I use regex in python to store the integers(positive and negative) i want into a list! For example This is the data in a list. ``` data = [u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=-5,B=5)', u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[3...
2016/10/10
[ "https://Stackoverflow.com/questions/39961414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6949864/" ]
When you use `$(".form-control")`, jquery select all `.form-control` element. But you need to select target element using `this` variable in event function and use [`.prev()`](https://api.jquery.com/prev/) to select previous element. ```js $(".show").mousedown(function(){ $(this).prev().attr('type','text'); }).mou...
Just target the previous input instead of all inputs with the given class ```js $(".form-control").on("keyup", function() { if ($(this).val()) $(this).next(".show").show(); else $(this).next(".show").hide(); }).trigger('keyup'); $(".show").mousedown(function() { $(this).prev(".form-contro...