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
my import command is just "import project"
2017-11-24T06:26:21.000151
Troy
pythondev_help_Troy_2017-11-24T06:26:21.000151
1,511,504,781.000151
101,003
pythondev
help
this folder is defined in Pythonpath
2017-11-24T06:26:37.000079
Troy
pythondev_help_Troy_2017-11-24T06:26:37.000079
1,511,504,797.000079
101,004
pythondev
help
Yep, that's much better
2017-11-24T06:29:22.000409
Fabiola
pythondev_help_Fabiola_2017-11-24T06:29:22.000409
1,511,504,962.000409
101,005
pythondev
help
Was hoping for a shortcut but I had a feeling there wouldn't be one, appreciate the input nontheless
2017-11-24T06:31:42.000228
Scot
pythondev_help_Scot_2017-11-24T06:31:42.000228
1,511,505,102.000228
101,006
pythondev
help
`main` is a module inside `project.core`
2017-11-24T06:36:35.000389
Suellen
pythondev_help_Suellen_2017-11-24T06:36:35.000389
1,511,505,395.000389
101,007
pythondev
help
so, `from project.core import main` or `from project.core.main import stuff, thing, something_else`
2017-11-24T06:37:05.000233
Suellen
pythondev_help_Suellen_2017-11-24T06:37:05.000233
1,511,505,425.000233
101,008
pythondev
help
thank you all
2017-11-24T06:46:25.000244
Troy
pythondev_help_Troy_2017-11-24T06:46:25.000244
1,511,505,985.000244
101,009
pythondev
help
I must use `project.core` definition to use `main()` otherwise python don't recognize. Correct?
2017-11-24T06:50:29.000183
Troy
pythondev_help_Troy_2017-11-24T06:50:29.000183
1,511,506,229.000183
101,010
pythondev
help
to import something you need a full path to it, obviously
2017-11-24T06:51:32.000135
Suellen
pythondev_help_Suellen_2017-11-24T06:51:32.000135
1,511,506,292.000135
101,011
pythondev
help
so yes, if `main.py` is below `project.core`
2017-11-24T06:51:46.000253
Suellen
pythondev_help_Suellen_2017-11-24T06:51:46.000253
1,511,506,306.000253
101,012
pythondev
help
Any scrapy expert here?
2017-11-24T11:45:59.000345
Pasquale
pythondev_help_Pasquale_2017-11-24T11:45:59.000345
1,511,523,959.000345
101,013
pythondev
help
I am writing a Spider for which I need a custom JSON format like below: ``` { "state": "FL", "date": "2017-11-03T14:52:26.007Z", "games": [ { "name":"Game1" }, { "name":"Game2" } ] } ``` But since it is running line by line so generates output like: ``` [ {"state": "CA", "games": [...
2017-11-24T11:46:40.000024
Pasquale
pythondev_help_Pasquale_2017-11-24T11:46:40.000024
1,511,524,000.000024
101,014
pythondev
help
you need to make an accumulator function that will iterate over the list items and consolidate everything
2017-11-24T11:49:22.000141
Meg
pythondev_help_Meg_2017-11-24T11:49:22.000141
1,511,524,162.000141
101,015
pythondev
help
<@Pasquale> are you seeking output like the first format and you are getting the second one?
2017-11-24T11:57:38.000168
Seema
pythondev_help_Seema_2017-11-24T11:57:38.000168
1,511,524,658.000168
101,016
pythondev
help
thats what I gather. problem is, scrapy runs in a loop, so you need to have some accumulator function outside of that loop to maintain overall state
2017-11-24T11:59:08.000268
Meg
pythondev_help_Meg_2017-11-24T11:59:08.000268
1,511,524,748.000268
101,017
pythondev
help
then I agree, but... scrapy... :disappointed:
2017-11-24T12:00:33.000020
Seema
pythondev_help_Seema_2017-11-24T12:00:33.000020
1,511,524,833.00002
101,018
pythondev
help
there's also a <#C5PHT9EGK|webscraping> channel that could use some love, lol
2017-11-24T12:00:56.000151
Seema
pythondev_help_Seema_2017-11-24T12:00:56.000151
1,511,524,856.000151
101,019
pythondev
help
the second one.
2017-11-24T12:20:52.000021
Pasquale
pythondev_help_Pasquale_2017-11-24T12:20:52.000021
1,511,526,052.000021
101,020
pythondev
help
Sorry
2017-11-24T12:21:41.000226
Pasquale
pythondev_help_Pasquale_2017-11-24T12:21:41.000226
1,511,526,101.000226
101,021
pythondev
help
the first one
2017-11-24T12:21:45.000025
Pasquale
pythondev_help_Pasquale_2017-11-24T12:21:45.000025
1,511,526,105.000025
101,022
pythondev
help
:disappointed:
2017-11-24T12:21:46.000029
Pasquale
pythondev_help_Pasquale_2017-11-24T12:21:46.000029
1,511,526,106.000029
101,023
pythondev
help
<@Pasquale> do you know what dd82 was referring to when he said an accumulator?
2017-11-24T12:22:46.000044
Seema
pythondev_help_Seema_2017-11-24T12:22:46.000044
1,511,526,166.000044
101,024
pythondev
help
Hi, I hope this is the right place to ask! I'm currently trying to figure out a way to generate values from a system of first-order differential equations (namely the Lotka Volterra equations) without specifying a certain timeframe (e.g. it acts like a generator, yielding new values each time it's called). I have a rud...
2017-11-24T15:14:37.000149
Lakeesha
pythondev_help_Lakeesha_2017-11-24T15:14:37.000149
1,511,536,477.000149
101,025
pythondev
help
Is anyone familiar with the Curses library?
2017-11-24T18:15:12.000039
Doreen
pythondev_help_Doreen_2017-11-24T18:15:12.000039
1,511,547,312.000039
101,026
pythondev
help
I suspect you would like a coroutine. Unfortunately when you search for coroutine you'll get all sorts of asyncio. Here's a simply example of coroutine where the coroutine spits out a result iteratively
2017-11-24T23:46:21.000014
Seema
pythondev_help_Seema_2017-11-24T23:46:21.000014
1,511,567,181.000014
101,027
pythondev
help
```def fibonacci_co(): current = 0 next = 1 while True: current, next = next, next + current yield current for n in fibonacci_co(): if n &gt; 1000: break print(n, end=', ')````
2017-11-24T23:46:24.000043
Seema
pythondev_help_Seema_2017-11-24T23:46:24.000043
1,511,567,184.000043
101,028
pythondev
help
i want to know how to integrate python api in reactive native
2017-11-25T01:38:41.000010
Anthony
pythondev_help_Anthony_2017-11-25T01:38:41.000010
1,511,573,921.00001
101,029
pythondev
help
any SQL guru's here? I am trying to insert ~2 millions rows into a Postgres DB and no matter what method I try with SQL Alchemy It's super slow ( &gt; 5minutes ). Even using raw SQL it's slow, so I think I need to consider chunking more rows into the insert statement - is there a limit? Any other tips or advice on how ...
2017-11-25T01:49:00.000035
Wonda
pythondev_help_Wonda_2017-11-25T01:49:00.000035
1,511,574,540.000035
101,030
pythondev
help
<@Wonda> I don't have any solution to improve that. but insert 2 millions rows into database at the same time is bad. Let's think in cache. My solutions for that is cache everything, after then we will using a bot or service to handle cache.
2017-11-25T01:57:52.000030
France
pythondev_help_France_2017-11-25T01:57:52.000030
1,511,575,072.00003
101,031
pythondev
help
<@France> Yes, I wasn't going to do it all in one statement! :slightly_smiling_face: I think I'll try to do 500 at a time and see if that works
2017-11-25T02:14:29.000042
Wonda
pythondev_help_Wonda_2017-11-25T02:14:29.000042
1,511,576,069.000042
101,032
pythondev
help
<@Wonda> SQLALchemy docs have a page for exactly this use case: <http://docs.sqlalchemy.org/en/latest/faq/performance.html#i-m-inserting-400-000-rows-with-the-orm-and-it-s-really-slow>
2017-11-25T03:37:09.000079
Suellen
pythondev_help_Suellen_2017-11-25T03:37:09.000079
1,511,581,029.000079
101,033
pythondev
help
TLDR: Use `bulk_insert_mappings()` and commit after every thousand inserts or so
2017-11-25T03:38:43.000016
Suellen
pythondev_help_Suellen_2017-11-25T03:38:43.000016
1,511,581,123.000016
101,034
pythondev
help
<@Suellen> :taco:
2017-11-25T04:27:04.000039
Wonda
pythondev_help_Wonda_2017-11-25T04:27:04.000039
1,511,584,024.000039
101,035
pythondev
help
:tada: yay
2017-11-25T04:27:22.000036
Suellen
pythondev_help_Suellen_2017-11-25T04:27:22.000036
1,511,584,042.000036
101,036
pythondev
help
thanks!
2017-11-25T04:27:26.000063
Wonda
pythondev_help_Wonda_2017-11-25T04:27:26.000063
1,511,584,046.000063
101,037
pythondev
help
<@Wonda> dml has impact on redo and undo in the database so it’s normal to be a little slower when you insert big numbers of rows. It is a transaction and if you do like 2 millions the rdbms needs to be able to rollback it when needed. In your case it is recommended to look for bulk inserts, hints, nologging, loads / i...
2017-11-25T09:58:39.000069
Louvenia
pythondev_help_Louvenia_2017-11-25T09:58:39.000069
1,511,603,919.000069
101,038
pythondev
help
hey guys
2017-11-25T15:27:27.000040
Zelma
pythondev_help_Zelma_2017-11-25T15:27:27.000040
1,511,623,647.00004
101,039
pythondev
help
So i am new to python, I am on linux and i seem to have python (v2.7) and python3 preinstalled
2017-11-25T15:27:52.000060
Zelma
pythondev_help_Zelma_2017-11-25T15:27:52.000060
1,511,623,672.00006
101,040
pythondev
help
when i open my vscode IDE it tries to install a bunch of things like my linter (which will run the commands against the /usr/bin/python binary and not the v3 one)
2017-11-25T15:28:40.000077
Zelma
pythondev_help_Zelma_2017-11-25T15:28:40.000077
1,511,623,720.000077
101,041
pythondev
help
Am i supposed to change the symlink on my install if i want to use python3?
2017-11-25T15:29:01.000020
Zelma
pythondev_help_Zelma_2017-11-25T15:29:01.000020
1,511,623,741.00002
101,042
pythondev
help
Or do i have to upgrade the default version? Or what do i do?
2017-11-25T15:29:25.000033
Zelma
pythondev_help_Zelma_2017-11-25T15:29:25.000033
1,511,623,765.000033
101,043
pythondev
help
before installing anything you should check out virtualenv
2017-11-25T15:31:42.000043
Ciera
pythondev_help_Ciera_2017-11-25T15:31:42.000043
1,511,623,902.000043
101,044
pythondev
help
you don't want to install stuff on your system python as it's widely used by other tools
2017-11-25T15:32:00.000002
Ciera
pythondev_help_Ciera_2017-11-25T15:32:00.000002
1,511,623,920.000002
101,045
pythondev
help
I see.. so it isolates it for your project
2017-11-25T15:35:24.000017
Zelma
pythondev_help_Zelma_2017-11-25T15:35:24.000017
1,511,624,124.000017
101,046
pythondev
help
basically like NPM / Composer so you have your dependencies for your project only?
2017-11-25T15:35:48.000055
Zelma
pythondev_help_Zelma_2017-11-25T15:35:48.000055
1,511,624,148.000055
101,047
pythondev
help
yeah exactly
2017-11-25T15:36:11.000042
Ciera
pythondev_help_Ciera_2017-11-25T15:36:11.000042
1,511,624,171.000042
101,048
pythondev
help
depending on your system you might also want to compile the latest python `3.6.3` so you can learn with the newest
2017-11-25T15:36:45.000058
Ciera
pythondev_help_Ciera_2017-11-25T15:36:45.000058
1,511,624,205.000058
101,049
pythondev
help
there are multiple tools that can help you with that. I would recommend `pyenv` or `pythonz`
2017-11-25T15:37:27.000045
Ciera
pythondev_help_Ciera_2017-11-25T15:37:27.000045
1,511,624,247.000045
101,050
pythondev
help
so wait.. i dont even know what all those things are yet.. i want to run a python script and now i hear about virtualenv, pip, pyenv, pythonz
2017-11-25T15:39:16.000059
Zelma
pythondev_help_Zelma_2017-11-25T15:39:16.000059
1,511,624,356.000059
101,051
pythondev
help
pythonz is like nvm?
2017-11-25T15:39:52.000015
Zelma
pythondev_help_Zelma_2017-11-25T15:39:52.000015
1,511,624,392.000015
101,052
pythondev
help
If you just want to run a python script you can easily run it with your system python. Then if you need to install dependencies you should use a virtualenv that split dependencies per project and you use pip to install the modules you need
2017-11-25T15:42:37.000076
Ciera
pythondev_help_Ciera_2017-11-25T15:42:37.000076
1,511,624,557.000076
101,053
pythondev
help
What you can also do is install other version of python if you want to develop on them. Theses version should be installed alongside your system python because replacing it could cause some bugs for your system
2017-11-25T15:43:51.000021
Ciera
pythondev_help_Ciera_2017-11-25T15:43:51.000021
1,511,624,631.000021
101,054
pythondev
help
I see.. but what do i point to in my python scripts? #!/usr/bin/env python ?
2017-11-25T15:44:43.000043
Zelma
pythondev_help_Zelma_2017-11-25T15:44:43.000043
1,511,624,683.000043
101,055
pythondev
help
If you are on a recent linux your python3 version should be at least `3.5.x`. There is now python `3.6.x` but it doesn't changes a lot of things especially if you are a beginner
2017-11-25T15:45:10.000068
Ciera
pythondev_help_Ciera_2017-11-25T15:45:10.000068
1,511,624,710.000068
101,056
pythondev
help
I believe `#!/usr/bin/env python` is correct but I usually don't put a shebang so I'm not sure
2017-11-25T15:45:38.000084
Ciera
pythondev_help_Ciera_2017-11-25T15:45:38.000084
1,511,624,738.000084
101,057
pythondev
help
Well if i want to use v3 for it (any 3.* version should be compatible with any v3 version if python follows semver) So would i target python3?
2017-11-25T15:48:11.000045
Zelma
pythondev_help_Zelma_2017-11-25T15:48:11.000045
1,511,624,891.000045
101,058
pythondev
help
if your script only run on python3 yes
2017-11-25T15:50:09.000008
Ciera
pythondev_help_Ciera_2017-11-25T15:50:09.000008
1,511,625,009.000008
101,059
pythondev
help
usually python without version point to python2
2017-11-25T15:50:27.000020
Ciera
pythondev_help_Ciera_2017-11-25T15:50:27.000020
1,511,625,027.00002
101,060
pythondev
help
I see..
2017-11-25T15:51:57.000029
Zelma
pythondev_help_Zelma_2017-11-25T15:51:57.000029
1,511,625,117.000029
101,061
pythondev
help
So what is pyvenv? the pythonz docs point to it if python &gt;= 3.3
2017-11-25T15:52:34.000063
Zelma
pythondev_help_Zelma_2017-11-25T15:52:34.000063
1,511,625,154.000063
101,062
pythondev
help
I want to use the latest version of python.. so definitely &gt;= 3.3
2017-11-25T15:52:50.000043
Zelma
pythondev_help_Zelma_2017-11-25T15:52:50.000043
1,511,625,170.000043
101,063
pythondev
help
If you build on python3 I personally recommend aiming compatibility for python3.5 and up
2017-11-25T15:53:56.000081
Ciera
pythondev_help_Ciera_2017-11-25T15:53:56.000081
1,511,625,236.000081
101,064
pythondev
help
but then it can depends on what you are doing
2017-11-25T15:54:06.000084
Ciera
pythondev_help_Ciera_2017-11-25T15:54:06.000084
1,511,625,246.000084
101,065
pythondev
help
Why does it matter if i use 3.4 or 3.5 or 3.6? Shouldn't they all work with python3
2017-11-25T15:54:54.000058
Zelma
pythondev_help_Zelma_2017-11-25T15:54:54.000058
1,511,625,294.000058
101,066
pythondev
help
they are all forward compatible but 3.5 and 3.6 brings new features that aren't supported on older version
2017-11-25T15:55:41.000051
Ciera
pythondev_help_Ciera_2017-11-25T15:55:41.000051
1,511,625,341.000051
101,067
pythondev
help
that sounds like it is not forward compatible at all if they aren't supported
2017-11-25T15:57:28.000030
Zelma
pythondev_help_Zelma_2017-11-25T15:57:28.000030
1,511,625,448.00003
101,068
pythondev
help
That they have new features should be obvious (hence the version bump)
2017-11-25T15:58:24.000045
Zelma
pythondev_help_Zelma_2017-11-25T15:58:24.000045
1,511,625,504.000045
101,069
pythondev
help
well a new feature in 3.5 is not supported in 3.4
2017-11-25T16:00:29.000041
Ciera
pythondev_help_Ciera_2017-11-25T16:00:29.000041
1,511,625,629.000041
101,070
pythondev
help
Yeah of course
2017-11-25T16:05:25.000065
Zelma
pythondev_help_Zelma_2017-11-25T16:05:25.000065
1,511,625,925.000065
101,071
pythondev
help
so having in mind that i want to use python &gt;= 3.3
2017-11-25T16:05:42.000086
Zelma
pythondev_help_Zelma_2017-11-25T16:05:42.000086
1,511,625,942.000086
101,072
pythondev
help
And i already have installed pythonz and my pthon 3.6.2 is ready to go
2017-11-25T16:06:18.000070
Zelma
pythondev_help_Zelma_2017-11-25T16:06:18.000070
1,511,625,978.00007
101,073
pythondev
help
whats the next step for me here? Do i install virtualenv or venv (Which seems to be the new thing since python 3.3?)
2017-11-25T16:07:01.000012
Zelma
pythondev_help_Zelma_2017-11-25T16:07:01.000012
1,511,626,021.000012
101,074
pythondev
help
you can create a virtualenv with `/path/to/python -m venv path/to/env`
2017-11-25T16:07:58.000068
Ciera
pythondev_help_Ciera_2017-11-25T16:07:58.000068
1,511,626,078.000068
101,075
pythondev
help
and then activate it with `. path/to/env/bin/activate`
2017-11-25T16:08:19.000002
Ciera
pythondev_help_Ciera_2017-11-25T16:08:19.000002
1,511,626,099.000002
101,076
pythondev
help
"/path/to/env" is my directory? like a npm project directory?
2017-11-25T16:09:17.000037
Zelma
pythondev_help_Zelma_2017-11-25T16:09:17.000037
1,511,626,157.000037
101,077
pythondev
help
and the path/to/python is just any python version? Or do i have to use the pythonz binary path)
2017-11-25T16:09:38.000023
Zelma
pythondev_help_Zelma_2017-11-25T16:09:38.000023
1,511,626,178.000023
101,078
pythondev
help
paht to env is the path to the env direcory. So usually your/project/.env
2017-11-25T16:10:30.000033
Ciera
pythondev_help_Ciera_2017-11-25T16:10:30.000033
1,511,626,230.000033
101,079
pythondev
help
and you need to use the python executable of the version you want your env to be in
2017-11-25T16:10:48.000002
Ciera
pythondev_help_Ciera_2017-11-25T16:10:48.000002
1,511,626,248.000002
101,080
pythondev
help
so in my case pythonz locate 3.6.2
2017-11-25T16:12:03.000052
Zelma
pythondev_help_Zelma_2017-11-25T16:12:03.000052
1,511,626,323.000052
101,081
pythondev
help
yep
2017-11-25T16:12:23.000039
Ciera
pythondev_help_Ciera_2017-11-25T16:12:23.000039
1,511,626,343.000039
101,082
pythondev
help
So i did this and it created a pyenv.cfg file and a bunch of folders
2017-11-25T16:15:22.000072
Zelma
pythondev_help_Zelma_2017-11-25T16:15:22.000072
1,511,626,522.000072
101,083
pythondev
help
So following the docs from <https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments>
2017-11-25T16:18:34.000049
Zelma
pythondev_help_Zelma_2017-11-25T16:18:34.000049
1,511,626,714.000049
101,084
pythondev
help
i activated the environment with source ./bin/activate
2017-11-25T16:18:49.000104
Zelma
pythondev_help_Zelma_2017-11-25T16:18:49.000104
1,511,626,729.000104
101,085
pythondev
help
and now executing the script which was targeting python now outputs v3.6.2
2017-11-25T16:19:13.000013
Zelma
pythondev_help_Zelma_2017-11-25T16:19:13.000013
1,511,626,753.000013
101,086
pythondev
help
so that seems like a good start
2017-11-25T16:19:17.000071
Zelma
pythondev_help_Zelma_2017-11-25T16:19:17.000071
1,511,626,757.000071
101,087
pythondev
help
now you can `pip install stuff` safely without risking to mess your system python :thumbsup:
2017-11-25T16:19:41.000005
Ciera
pythondev_help_Ciera_2017-11-25T16:19:41.000005
1,511,626,781.000005
101,088
pythondev
help
And if i change projects i pretty much do the same there but then activate the other project and install stuff there via pip
2017-11-25T16:20:13.000033
Zelma
pythondev_help_Zelma_2017-11-25T16:20:13.000033
1,511,626,813.000033
101,089
pythondev
help
yes
2017-11-25T16:21:09.000105
Ciera
pythondev_help_Ciera_2017-11-25T16:21:09.000105
1,511,626,869.000105
101,090
pythondev
help
So why did you point me to virtualenv in the beginning? Did you assume i was using a python version below 3.3? or is there some additional benefit of using it?
2017-11-25T16:21:37.000055
Zelma
pythondev_help_Zelma_2017-11-25T16:21:37.000055
1,511,626,897.000055
101,091
pythondev
help
I'm just used to say virtualenv. They are all the same things, it's just the way to create them that changed
2017-11-25T16:22:44.000045
Ciera
pythondev_help_Ciera_2017-11-25T16:22:44.000045
1,511,626,964.000045
101,092
pythondev
help
ahh i see..
2017-11-25T16:25:43.000060
Zelma
pythondev_help_Zelma_2017-11-25T16:25:43.000060
1,511,627,143.00006
101,093
pythondev
help
i am getting a bunch of errors trying to pip install things
2017-11-25T16:28:39.000039
Zelma
pythondev_help_Zelma_2017-11-25T16:28:39.000039
1,511,627,319.000039
101,094
pythondev
help
first of all i installed setuptools using sudo pip install setuptools
2017-11-25T16:28:54.000043
Zelma
pythondev_help_Zelma_2017-11-25T16:28:54.000043
1,511,627,334.000043
101,095
pythondev
help
and it gives me "Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages"
2017-11-25T16:29:02.000049
Zelma
pythondev_help_Zelma_2017-11-25T16:29:02.000049
1,511,627,342.000049
101,096
pythondev
help
you shouldn't need to `sudo`
2017-11-25T16:29:19.000051
Ciera
pythondev_help_Ciera_2017-11-25T16:29:19.000051
1,511,627,359.000051
101,097
pythondev
help
which does not really sound like it is inside the virtual env?
2017-11-25T16:29:20.000061
Zelma
pythondev_help_Zelma_2017-11-25T16:29:20.000061
1,511,627,360.000061
101,098
pythondev
help
that gave me a permission error earlier without sudo
2017-11-25T16:29:32.000081
Zelma
pythondev_help_Zelma_2017-11-25T16:29:32.000081
1,511,627,372.000081
101,099
pythondev
help
and are you sure your env is activated ?
2017-11-25T16:29:37.000064
Ciera
pythondev_help_Ciera_2017-11-25T16:29:37.000064
1,511,627,377.000064
101,100
pythondev
help
it says "(python_test) name@name-pc ~python_test $
2017-11-25T16:29:56.000083
Zelma
pythondev_help_Zelma_2017-11-25T16:29:56.000083
1,511,627,396.000083
101,101
pythondev
help
so it sounds like it is correct
2017-11-25T16:30:14.000032
Zelma
pythondev_help_Zelma_2017-11-25T16:30:14.000032
1,511,627,414.000032
101,102