workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
errors typically tell you exactly where they come from, with a line number
2017-07-25T10:16:28.359595
Gabriele
pythondev_help_Gabriele_2017-07-25T10:16:28.359595
1,500,977,788.359595
87,203
pythondev
help
Ah shiet
2017-07-25T10:16:47.371204
Myong
pythondev_help_Myong_2017-07-25T10:16:47.371204
1,500,977,807.371204
87,204
pythondev
help
Got it, bad indent into init
2017-07-25T10:16:52.374763
Myong
pythondev_help_Myong_2017-07-25T10:16:52.374763
1,500,977,812.374763
87,205
pythondev
help
<@Gertude> For your personal development you should read more about the language and practice with it, improving your code as you go
2017-07-25T10:17:00.379676
Gabriele
pythondev_help_Gabriele_2017-07-25T10:17:00.379676
1,500,977,820.379676
87,206
pythondev
help
Got it thank you
2017-07-25T10:17:26.395719
Gertude
pythondev_help_Gertude_2017-07-25T10:17:26.395719
1,500,977,846.395719
87,207
pythondev
help
<https://www.amazon.com/Effective-Python-Specific-Software-Development/dp/0134034287/ref=sr_1_1?ie=UTF8&amp;qid=1500992243&amp;sr=8-1&amp;keywords=effective+python>
2017-07-25T10:17:29.397835
Meg
pythondev_help_Meg_2017-07-25T10:17:29.397835
1,500,977,849.397835
87,208
pythondev
help
is a great resource
2017-07-25T10:17:33.400336
Meg
pythondev_help_Meg_2017-07-25T10:17:33.400336
1,500,977,853.400336
87,209
pythondev
help
<@Meg> Thank you, I get bored from intros though, because as you saw I can write some code that works but not happy with the quality.
2017-07-25T10:19:30.474435
Gertude
pythondev_help_Gertude_2017-07-25T10:19:30.474435
1,500,977,970.474435
87,210
pythondev
help
But I see it doesn't have intros and it's spot on to functions
2017-07-25T10:19:58.491935
Gertude
pythondev_help_Gertude_2017-07-25T10:19:58.491935
1,500,977,998.491935
87,211
pythondev
help
correct
2017-07-25T10:21:02.532841
Meg
pythondev_help_Meg_2017-07-25T10:21:02.532841
1,500,978,062.532841
87,212
pythondev
help
it gives you an item of specific consideration
2017-07-25T10:21:14.540229
Meg
pythondev_help_Meg_2017-07-25T10:21:14.540229
1,500,978,074.540229
87,213
pythondev
help
and does a good evaluation throughout
2017-07-25T10:21:21.545140
Meg
pythondev_help_Meg_2017-07-25T10:21:21.545140
1,500,978,081.54514
87,214
pythondev
help
There's not really any good way to get good at programming without starting at the beginning and making sure you understand the fundamental building blocks: control flow statements, functions, variables and objects, types, structures and classes, etc
2017-07-25T10:21:51.564086
Gabriele
pythondev_help_Gabriele_2017-07-25T10:21:51.564086
1,500,978,111.564086
87,215
pythondev
help
I'm assuming <@Gertude> has some experience with that
2017-07-25T10:22:08.575027
Meg
pythondev_help_Meg_2017-07-25T10:22:08.575027
1,500,978,128.575027
87,216
pythondev
help
Above: _" I read about functions except I never really implemented one"_
2017-07-25T10:22:34.591885
Gabriele
pythondev_help_Gabriele_2017-07-25T10:22:34.591885
1,500,978,154.591885
87,217
pythondev
help
oh
2017-07-25T10:22:56.606287
Meg
pythondev_help_Meg_2017-07-25T10:22:56.606287
1,500,978,176.606287
87,218
pythondev
help
Yes true, I read and I know the fundamentals but to add two numbers and such
2017-07-25T10:23:07.613174
Gertude
pythondev_help_Gertude_2017-07-25T10:23:07.613174
1,500,978,187.613174
87,219
pythondev
help
missed that, been in and out
2017-07-25T10:23:11.615650
Meg
pythondev_help_Meg_2017-07-25T10:23:11.615650
1,500,978,191.61565
87,220
pythondev
help
writing a function (along with creating your own classes) are part of the fundamentals
2017-07-25T10:23:30.628239
Gabriele
pythondev_help_Gabriele_2017-07-25T10:23:30.628239
1,500,978,210.628239
87,221
pythondev
help
fluent python might be better
2017-07-25T10:23:50.641188
Meg
pythondev_help_Meg_2017-07-25T10:23:50.641188
1,500,978,230.641188
87,222
pythondev
help
<https://www.amazon.com/Fluent-Python-Concise-Effective-Programming/dp/1491946008/ref=sr_1_1?ie=UTF8&amp;qid=1500992603&amp;sr=8-1&amp;keywords=fluent+python>
2017-07-25T10:23:51.641610
Meg
pythondev_help_Meg_2017-07-25T10:23:51.641610
1,500,978,231.64161
87,223
pythondev
help
So I think back to the code I should implement a `re.finder` Function and pass the patterns later on
2017-07-25T10:24:02.649045
Gertude
pythondev_help_Gertude_2017-07-25T10:24:02.649045
1,500,978,242.649045
87,224
pythondev
help
No... you wouldn't be adding a `finder` function to `re`
2017-07-25T10:24:41.674471
Gabriele
pythondev_help_Gabriele_2017-07-25T10:24:41.674471
1,500,978,281.674471
87,225
pythondev
help
But you could write a function that does contain all the 'finding', if you liked
2017-07-25T10:25:16.697611
Gabriele
pythondev_help_Gabriele_2017-07-25T10:25:16.697611
1,500,978,316.697611
87,226
pythondev
help
Ah huh
2017-07-25T10:25:26.704810
Gertude
pythondev_help_Gertude_2017-07-25T10:25:26.704810
1,500,978,326.70481
87,227
pythondev
help
One function that has all the finding with all the patterns
2017-07-25T10:25:39.713201
Gertude
pythondev_help_Gertude_2017-07-25T10:25:39.713201
1,500,978,339.713201
87,228
pythondev
help
And when writing I call the right one?
2017-07-25T10:25:47.718140
Gertude
pythondev_help_Gertude_2017-07-25T10:25:47.718140
1,500,978,347.71814
87,229
pythondev
help
I don't know what you mean by that. The alternative would be to call the wrong one...
2017-07-25T10:26:24.742554
Gabriele
pythondev_help_Gabriele_2017-07-25T10:26:24.742554
1,500,978,384.742554
87,230
pythondev
help
The function would have the `re.findall` with all the patterns, and when writing to the csv I call one from what I define at the top
2017-07-25T10:27:18.777132
Gertude
pythondev_help_Gertude_2017-07-25T10:27:18.777132
1,500,978,438.777132
87,231
pythondev
help
Best to shut up and go read, thank you both
2017-07-25T10:27:39.791179
Gertude
pythondev_help_Gertude_2017-07-25T10:27:39.791179
1,500,978,459.791179
87,232
pythondev
help
Good for getting date input?
2017-07-25T11:09:47.491356
Myong
pythondev_help_Myong_2017-07-25T11:09:47.491356
1,500,980,987.491356
87,233
pythondev
help
It looks like it would work
2017-07-25T11:13:19.631267
Gabriele
pythondev_help_Gabriele_2017-07-25T11:13:19.631267
1,500,981,199.631267
87,234
pythondev
help
Is `ConfigParser` a pretty good tool for setting up constants
2017-07-25T12:17:46.228512
Myong
pythondev_help_Myong_2017-07-25T12:17:46.228512
1,500,985,066.228512
87,235
pythondev
help
About to get started with it
2017-07-25T12:17:51.231475
Myong
pythondev_help_Myong_2017-07-25T12:17:51.231475
1,500,985,071.231475
87,236
pythondev
help
You don't really need it if you're not distributing or deploying your software, but for managing configuration constants, sure, it works
2017-07-25T12:19:28.290991
Gabriele
pythondev_help_Gabriele_2017-07-25T12:19:28.290991
1,500,985,168.290991
87,237
pythondev
help
I've just got a global constant `.py` file with values, but I also need to be able to set global constants based on user input. They're being set in a class so I suppose I could always just pass the class object around and grab values that way, but I'm sort of looking for something a bit nicer
2017-07-25T12:20:21.324317
Myong
pythondev_help_Myong_2017-07-25T12:20:21.324317
1,500,985,221.324317
87,238
pythondev
help
if it's user input then configparser is the wrong tool
2017-07-25T12:24:39.483920
Gabriele
pythondev_help_Gabriele_2017-07-25T12:24:39.483920
1,500,985,479.48392
87,239
pythondev
help
generally what I do these days is a combination of environment variables and Click for the CLI
2017-07-25T12:29:47.673400
Junita
pythondev_help_Junita_2017-07-25T12:29:47.673400
1,500,985,787.6734
87,240
pythondev
help
:thumbsup: for click.
2017-07-25T12:30:10.687514
Johana
pythondev_help_Johana_2017-07-25T12:30:10.687514
1,500,985,810.687514
87,241
pythondev
help
loading from a .env file as well if people want to have stuff in there
2017-07-25T12:30:14.689803
Junita
pythondev_help_Junita_2017-07-25T12:30:14.689803
1,500,985,814.689803
87,242
pythondev
help
i like having a .env.example file
2017-07-25T12:30:25.696957
Johana
pythondev_help_Johana_2017-07-25T12:30:25.696957
1,500,985,825.696957
87,243
pythondev
help
^ Always helps clear up so many questions for most people
2017-07-25T12:31:28.736529
Marilyn
pythondev_help_Marilyn_2017-07-25T12:31:28.736529
1,500,985,888.736529
87,244
pythondev
help
and if it’s something like a flask app, I’ll usually tie it all together in a `config.py`
2017-07-25T12:32:57.789971
Junita
pythondev_help_Junita_2017-07-25T12:32:57.789971
1,500,985,977.789971
87,245
pythondev
help
Hey guys, using `sqlalchemy` I have field `created_at = db.Column(db.DateTime, nullable=True)` and I confused, How I can get data by datetime. For example, I need get data for current day. and I did something like this. ``` db.session.query(Post).join(User). \ filter(Post.user_id == user_id). \ filter(Post.user_type == 'eng').\ filter(Post.created_at == get_today()) ``` ``` def get_today(): return datetime.now() ``` But the example didn’t work(
2017-07-25T13:03:24.883798
Bella
pythondev_help_Bella_2017-07-25T13:03:24.883798
1,500,987,804.883798
87,246
pythondev
help
are you getting None or something?
2017-07-25T13:05:02.942685
Meg
pythondev_help_Meg_2017-07-25T13:05:02.942685
1,500,987,902.942685
87,247
pythondev
help
just empty array
2017-07-25T13:05:29.958794
Bella
pythondev_help_Bella_2017-07-25T13:05:29.958794
1,500,987,929.958794
87,248
pythondev
help
Right now you are filtering based on this exact moment
2017-07-25T13:05:33.961184
Beula
pythondev_help_Beula_2017-07-25T13:05:33.961184
1,500,987,933.961184
87,249
pythondev
help
so that understandably won't work
2017-07-25T13:05:38.964396
Beula
pythondev_help_Beula_2017-07-25T13:05:38.964396
1,500,987,938.964396
87,250
pythondev
help
but in the database I have record with current day.
2017-07-25T13:05:50.971821
Bella
pythondev_help_Bella_2017-07-25T13:05:50.971821
1,500,987,950.971821
87,251
pythondev
help
day, yes
2017-07-25T13:05:56.975181
Meg
pythondev_help_Meg_2017-07-25T13:05:56.975181
1,500,987,956.975181
87,252
pythondev
help
but not the current minute, second, hour of the request
2017-07-25T13:06:06.981631
Meg
pythondev_help_Meg_2017-07-25T13:06:06.981631
1,500,987,966.981631
87,253
pythondev
help
`datetime.now()` against a timefield will be date/time
2017-07-25T13:06:18.988679
Beula
pythondev_help_Beula_2017-07-25T13:06:18.988679
1,500,987,978.988679
87,254
pythondev
help
`date.now()` may work
2017-07-25T13:06:33.997944
Beula
pythondev_help_Beula_2017-07-25T13:06:33.997944
1,500,987,993.997944
87,255
pythondev
help
I think you may need a between query for start/end of the day
2017-07-25T13:07:37.035516
Beula
pythondev_help_Beula_2017-07-25T13:07:37.035516
1,500,988,057.035516
87,256
pythondev
help
You think it's best to create a `.env` file for the user and give an example or create one if one does not exist in the directory and write to it?
2017-07-25T13:08:43.074132
Myong
pythondev_help_Myong_2017-07-25T13:08:43.074132
1,500,988,123.074132
87,257
pythondev
help
The standard is `.*rc` files, so I usually use `~/.foorc`
2017-07-25T13:09:16.092730
Beula
pythondev_help_Beula_2017-07-25T13:09:16.092730
1,500,988,156.09273
87,258
pythondev
help
At least on linux
2017-07-25T13:09:21.095715
Beula
pythondev_help_Beula_2017-07-25T13:09:21.095715
1,500,988,161.095715
87,259
pythondev
help
<@Beula> Yes, I need implement `between` too, but first need to implmenet for current day, 2 minutes, I’ll try
2017-07-25T13:09:32.101830
Bella
pythondev_help_Bella_2017-07-25T13:09:32.101830
1,500,988,172.10183
87,260
pythondev
help
Well between start of day and end of day is "current date" - which is what I am getting at
2017-07-25T13:09:48.111192
Beula
pythondev_help_Beula_2017-07-25T13:09:48.111192
1,500,988,188.111192
87,261
pythondev
help
<@Johana> was it you that had the `example.env` file?
2017-07-25T13:15:08.296023
Myong
pythondev_help_Myong_2017-07-25T13:15:08.296023
1,500,988,508.296023
87,262
pythondev
help
env.example ya
2017-07-25T13:17:19.371396
Johana
pythondev_help_Johana_2017-07-25T13:17:19.371396
1,500,988,639.371396
87,263
pythondev
help
or `.env.example` my bad.
2017-07-25T13:17:33.379764
Johana
pythondev_help_Johana_2017-07-25T13:17:33.379764
1,500,988,653.379764
87,264
pythondev
help
Is that in your gists?
2017-07-25T13:17:56.392831
Myong
pythondev_help_Myong_2017-07-25T13:17:56.392831
1,500,988,676.392831
87,265
pythondev
help
no but i can create one.
2017-07-25T13:19:27.445076
Johana
pythondev_help_Johana_2017-07-25T13:19:27.445076
1,500,988,767.445076
87,266
pythondev
help
`.env.example` ``` export PY_ENV="development" export GITHUB_TOKEN="" export SOME_API_URL="" export SOME_API_TOKEN="" export DB_USER="" export DB_PASSWORD="" export DB_HOST="" export DB_NAME="" ```
2017-07-25T13:20:41.487177
Johana
pythondev_help_Johana_2017-07-25T13:20:41.487177
1,500,988,841.487177
87,267
pythondev
help
then you can run `cp .env.example .env`
2017-07-25T13:21:12.504987
Johana
pythondev_help_Johana_2017-07-25T13:21:12.504987
1,500,988,872.504987
87,268
pythondev
help
and fill out the values
2017-07-25T13:21:17.507863
Johana
pythondev_help_Johana_2017-07-25T13:21:17.507863
1,500,988,877.507863
87,269
pythondev
help
then run `source .env` and be good to go.
2017-07-25T13:21:27.513799
Johana
pythondev_help_Johana_2017-07-25T13:21:27.513799
1,500,988,887.513799
87,270
pythondev
help
<@Beula> Okay, I’m tried.. but didn’t work( For example ``` return query.filter( and_( Post.created_at &gt; search_by_date(), Post.created_at &lt; get_today() ) ) ``` and methods ``` def search_by_date(days=None): if days: date = datetime.utcnow() - timedelta(days=int(days)) return date.strftime('%Y-%m-%d') else: yesterday = datetime.utcnow() - timedelta(days=1) return yesterday def get_today(): today = datetime.utcnow().strftime('%Y-%m-%d') return today ``` But for current day, it’s not working.. I understand in which way I need to move..:disappointed:
2017-07-25T13:47:28.434680
Bella
pythondev_help_Bella_2017-07-25T13:47:28.434680
1,500,990,448.43468
87,271
pythondev
help
I think you either want `&lt; get_today() + 1day` or to do `&lt;= get_today()`
2017-07-25T13:48:50.484749
Beula
pythondev_help_Beula_2017-07-25T13:48:50.484749
1,500,990,530.484749
87,272
pythondev
help
``` # Query # first didn't work return query.filter(Post.created_at == get_today()) # second # return posts after 25th July return query.filter(Post.created_at &gt;= get_today()) def get_today(): today = datetime.utcnow().strftime('%Y-%m-%d') return today ```
2017-07-25T13:58:36.841026
Bella
pythondev_help_Bella_2017-07-25T13:58:36.841026
1,500,991,116.841026
87,273
pythondev
help
Hello, I would like to test a system with several AMQP consumer/producers that are exchanging messages with each other. I would like to have unit-testing with those consumers. Is there a commonly used design pattern for doing so in Python? (I'm using pytest at the moment with a fixture that look like this:
2017-07-25T14:28:06.943200
Celine
pythondev_help_Celine_2017-07-25T14:28:06.943200
1,500,992,886.9432
87,274
pythondev
help
At the moment my set-up is this: My consumers inherit from multiprocessing.Process and when started set-up their AMQP environment. When the test is finished, the terminate closes the connection and cancel everything. The problem that I get is that even when a test completed, the Process of the consumers seems to continue running in the background even after I called terminate. How could I have a nice clean-up when the test is over? Would it change something to have BlockingConnection instead of a SelectConnection ? Here is the current version of my base class for those components: <https://gist.github.com/sieben/caf39e04a83c812550d967a22b9d8584> is an obvious flaw in it? Is there an alternative from inheriting from Thread or Process ?
2017-07-25T14:28:35.960519
Celine
pythondev_help_Celine_2017-07-25T14:28:35.960519
1,500,992,915.960519
87,275
pythondev
help
Is there any way to run pycharm in debug with commandline arguments?
2017-07-25T15:02:13.170089
Myong
pythondev_help_Myong_2017-07-25T15:02:13.170089
1,500,994,933.170089
87,276
pythondev
help
yes
2017-07-25T15:03:13.205259
Meg
pythondev_help_Meg_2017-07-25T15:03:13.205259
1,500,994,993.205259
87,277
pythondev
help
Yeah, you can use the same run menu with command line args and click the debug icon instead of play - or are you seeing something funky?
2017-07-25T15:03:16.207279
Beula
pythondev_help_Beula_2017-07-25T15:03:16.207279
1,500,994,996.207279
87,278
pythondev
help
go to run configuration
2017-07-25T15:03:17.207513
Meg
pythondev_help_Meg_2017-07-25T15:03:17.207513
1,500,994,997.207513
87,279
pythondev
help
Is it under the script parameters
2017-07-25T15:11:35.482919
Myong
pythondev_help_Myong_2017-07-25T15:11:35.482919
1,500,995,495.482919
87,280
pythondev
help
Yep
2017-07-25T15:18:42.712369
Beula
pythondev_help_Beula_2017-07-25T15:18:42.712369
1,500,995,922.712369
87,281
pythondev
help
those are the args passed to it
2017-07-25T15:18:53.718262
Beula
pythondev_help_Beula_2017-07-25T15:18:53.718262
1,500,995,933.718262
87,282
pythondev
help
Got it
2017-07-25T15:19:48.747486
Myong
pythondev_help_Myong_2017-07-25T15:19:48.747486
1,500,995,988.747486
87,283
pythondev
help
I'm using a module called `simple_settings` and after a few times of accessing the configured settings I get
2017-07-25T15:52:27.802808
Myong
pythondev_help_Myong_2017-07-25T15:52:27.802808
1,500,997,947.802808
87,284
pythondev
help
lol
2017-07-25T15:53:39.842223
Myong
pythondev_help_Myong_2017-07-25T15:53:39.842223
1,500,998,019.842223
87,285
pythondev
help
But the stack trace pretty much shows all calls to the `simple_settings` module and I really don't understand why. I think I may just not use that at all to be honest. But wasn't sure if it was a mistake I made
2017-07-25T15:54:19.863541
Myong
pythondev_help_Myong_2017-07-25T15:54:19.863541
1,500,998,059.863541
87,286
pythondev
help
It seems to be going between these two
2017-07-25T15:57:34.972744
Myong
pythondev_help_Myong_2017-07-25T15:57:34.972744
1,500,998,254.972744
87,287
pythondev
help
well the stacktraces is pretty explicit
2017-07-25T16:00:54.090145
Ciera
pythondev_help_Ciera_2017-07-25T16:00:54.090145
1,500,998,454.090145
87,288
pythondev
help
python as a recursion limit that you reached
2017-07-25T16:01:03.094580
Ciera
pythondev_help_Ciera_2017-07-25T16:01:03.094580
1,500,998,463.09458
87,289
pythondev
help
Yeah, I guess maybe I didn't actually setup the module properly
2017-07-25T16:01:28.108771
Myong
pythondev_help_Myong_2017-07-25T16:01:28.108771
1,500,998,488.108771
87,290
pythondev
help
But it's odd that it goes between the two over and over I'm trying to get to it in debug
2017-07-25T16:01:58.126542
Myong
pythondev_help_Myong_2017-07-25T16:01:58.126542
1,500,998,518.126542
87,291
pythondev
help
well in fact the `__getattr__` func call `setup` and `setup` call `__getattr__` so it's endless
2017-07-25T16:02:15.136511
Ciera
pythondev_help_Ciera_2017-07-25T16:02:15.136511
1,500,998,535.136511
87,292
pythondev
help
cant even debug to where it breaks
2017-07-25T16:03:23.174341
Myong
pythondev_help_Myong_2017-07-25T16:03:23.174341
1,500,998,603.174341
87,293
pythondev
help
well it breaks as soon as the class is init or called
2017-07-25T16:04:18.204835
Ciera
pythondev_help_Ciera_2017-07-25T16:04:18.204835
1,500,998,658.204835
87,294
pythondev
help
as `__getattr__` is used quite a lot
2017-07-25T16:04:27.209811
Ciera
pythondev_help_Ciera_2017-07-25T16:04:27.209811
1,500,998,667.209811
87,295
pythondev
help
Yeah, looking at some stuff now it basically says if `__getattrb__` can access a variable which does not yet exist it will go into infinite recursion
2017-07-25T16:06:58.291672
Myong
pythondev_help_Myong_2017-07-25T16:06:58.291672
1,500,998,818.291672
87,296
pythondev
help
alright got rid of the module, not sure what was happening, figured out a different way
2017-07-25T16:14:45.543796
Myong
pythondev_help_Myong_2017-07-25T16:14:45.543796
1,500,999,285.543796
87,297
pythondev
help
Has anyone tried to get an event into the Python Weekly newsletter?
2017-07-25T17:38:25.148784
Elane
pythondev_help_Elane_2017-07-25T17:38:25.148784
1,501,004,305.148784
87,298
pythondev
help
Can’t find a point of contact
2017-07-25T17:38:49.159131
Elane
pythondev_help_Elane_2017-07-25T17:38:49.159131
1,501,004,329.159131
87,299
pythondev
help
<@Elane> <http://www.pythonweekly.com/> ?
2017-07-25T18:20:33.156959
Duane
pythondev_help_Duane_2017-07-25T18:20:33.156959
1,501,006,833.156959
87,300
pythondev
help
Yes but neither the site nor the email content has a contact link
2017-07-25T18:26:15.273888
Elane
pythondev_help_Elane_2017-07-25T18:26:15.273888
1,501,007,175.273888
87,301
pythondev
help
I think this is the guy <https://twitter.com/rahulgchaudhary>
2017-07-25T18:26:52.286534
Duane
pythondev_help_Duane_2017-07-25T18:26:52.286534
1,501,007,212.286534
87,302