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
would it be ok if we took this private and only report final solution or failure here EdKeyes?
2019-05-01T13:39:19.377500
Arcelia
pythondev_help_Arcelia_2019-05-01T13:39:19.377500
1,556,717,959.3775
21,821
pythondev
help
Sure, happy to have a closer look.
2019-05-01T13:39:36.377700
Sasha
pythondev_help_Sasha_2019-05-01T13:39:36.377700
1,556,717,976.3777
21,822
pythondev
help
<@Arcelia> just out of curiosity can you share what you are working on?
2019-05-01T13:51:22.378200
Christina
pythondev_help_Christina_2019-05-01T13:51:22.378200
1,556,718,682.3782
21,823
pythondev
help
Something poker related :slightly_smiling_face:
2019-05-01T13:52:23.378400
Arcelia
pythondev_help_Arcelia_2019-05-01T13:52:23.378400
1,556,718,743.3784
21,824
pythondev
help
Hello Guys, I would like inform you all developers they use Google Map APIs their will no longer work. Google Maps Platform Team describing that Google Place SDK used in their app will no longer work In May, Google Team announced the next generation of our business with Google Maps Platform. they introduced a number of improvements to our products to make them simpler, easier to use and scalable as you grow. Since then, they've continued to invest in our products, including Places, to help you solve problems, optimize business operations and build great experiences for your user *You don't know what to do you next ? check out this articles* :kissing_heart: <https://medium.com/@flutterhackserices/introducing-new-improved-places-sdks-1b60f876a2b>
2019-05-01T13:53:15.378600
Damon
pythondev_help_Damon_2019-05-01T13:53:15.378600
1,556,718,795.3786
21,825
pythondev
help
Hello
2019-05-01T14:01:19.379000
Elwanda
pythondev_help_Elwanda_2019-05-01T14:01:19.379000
1,556,719,279.379
21,826
pythondev
help
anyone fimilar with jupyter noteboook?
2019-05-01T14:01:42.379700
Elwanda
pythondev_help_Elwanda_2019-05-01T14:01:42.379700
1,556,719,302.3797
21,827
pythondev
help
If you have a question, please just ask it. Please do not ask for topic experts; do not DM or ping random users. We cannot begin to answer a question until we actually get a question. <http://sol.gfxile.net/dontask.html|*Asking Questions*>
2019-05-01T14:07:37.379800
Leana
pythondev_help_Leana_2019-05-01T14:07:37.379800
1,556,719,657.3798
21,828
pythondev
help
Oh ok
2019-05-01T14:08:49.380000
Elwanda
pythondev_help_Elwanda_2019-05-01T14:08:49.380000
1,556,719,729.38
21,829
pythondev
help
When i write a program in jupyter and run it , it jumps to the next line
2019-05-01T14:09:16.380900
Elwanda
pythondev_help_Elwanda_2019-05-01T14:09:16.380900
1,556,719,756.3809
21,830
pythondev
help
why?
2019-05-01T14:09:19.381200
Elwanda
pythondev_help_Elwanda_2019-05-01T14:09:19.381200
1,556,719,759.3812
21,831
pythondev
help
why cant i run it?
2019-05-01T14:09:22.381400
Elwanda
pythondev_help_Elwanda_2019-05-01T14:09:22.381400
1,556,719,762.3814
21,832
pythondev
help
I'm not going to 'how to ask' guide you too much but you need to show your code. Show us some snippets to understand your case. People aren't mind readers but we would love to help. Share some info and help people help you :)
2019-05-01T14:12:19.383400
Christina
pythondev_help_Christina_2019-05-01T14:12:19.383400
1,556,719,939.3834
21,833
pythondev
help
None
2019-05-01T14:13:22.383500
Elwanda
pythondev_help_Elwanda_2019-05-01T14:13:22.383500
1,556,720,002.3835
21,834
pythondev
help
You are asking for input. Are you supplying that? And I assume you have to print it as well if you want output. If that is all your code
2019-05-01T14:14:39.384900
Christina
pythondev_help_Christina_2019-05-01T14:14:39.384900
1,556,720,079.3849
21,835
pythondev
help
yeah
2019-05-01T14:15:03.385300
Elwanda
pythondev_help_Elwanda_2019-05-01T14:15:03.385300
1,556,720,103.3853
21,836
pythondev
help
Is it possible that instead of running your code, you're telling Jupyter to "step" through your code?
2019-05-01T14:17:20.386000
Sasha
pythondev_help_Sasha_2019-05-01T14:17:20.386000
1,556,720,240.386
21,837
pythondev
help
Dont think so...
2019-05-01T14:18:53.386400
Elwanda
pythondev_help_Elwanda_2019-05-01T14:18:53.386400
1,556,720,333.3864
21,838
pythondev
help
how are you running it?
2019-05-01T14:19:44.386600
Clemmie
pythondev_help_Clemmie_2019-05-01T14:19:44.386600
1,556,720,384.3866
21,839
pythondev
help
By clicking on run
2019-05-01T14:20:07.386900
Elwanda
pythondev_help_Elwanda_2019-05-01T14:20:07.386900
1,556,720,407.3869
21,840
pythondev
help
and it is giving you a prompt to input the name, lunch?
2019-05-01T14:21:01.387300
Clemmie
pythondev_help_Clemmie_2019-05-01T14:21:01.387300
1,556,720,461.3873
21,841
pythondev
help
no
2019-05-01T14:21:19.387500
Elwanda
pythondev_help_Elwanda_2019-05-01T14:21:19.387500
1,556,720,479.3875
21,842
pythondev
help
it jumps to a new input
2019-05-01T14:21:40.388000
Elwanda
pythondev_help_Elwanda_2019-05-01T14:21:40.388000
1,556,720,500.388
21,843
pythondev
help
<@Claude> please move this to <#C080T8XT2|job_board>
2019-05-01T14:29:02.388800
Clemmie
pythondev_help_Clemmie_2019-05-01T14:29:02.388800
1,556,720,942.3888
21,844
pythondev
help
<@Clemmie> Thank you so much! Doing that now
2019-05-01T14:29:55.389300
Claude
pythondev_help_Claude_2019-05-01T14:29:55.389300
1,556,720,995.3893
21,845
pythondev
help
Just ran your code and it is prompting me within that cell:
2019-05-01T14:56:00.389700
Raguel
pythondev_help_Raguel_2019-05-01T14:56:00.389700
1,556,722,560.3897
21,846
pythondev
help
anyone have examples of how to add periodic tasks to Celery worker/beat, WHILE celery work and beat are running (e.g. add more jobs from a web UI like flask)
2019-05-01T16:39:15.390300
Shirley
pythondev_help_Shirley_2019-05-01T16:39:15.390300
1,556,728,755.3903
21,847
pythondev
help
do classes not have a return statement?
2019-05-01T18:50:38.390800
Priscilla
pythondev_help_Priscilla_2019-05-01T18:50:38.390800
1,556,736,638.3908
21,848
pythondev
help
Nope
2019-05-01T18:54:37.391000
Bethany
pythondev_help_Bethany_2019-05-01T18:54:37.391000
1,556,736,877.391
21,849
pythondev
help
An object is like a bucket where you can add custom buttons. It holds things, and can know how to work with them. A class is a recipe to make a bucket
2019-05-01T18:56:13.393100
Bethany
pythondev_help_Bethany_2019-05-01T18:56:13.393100
1,556,736,973.3931
21,850
pythondev
help
i got in over my head
2019-05-01T18:58:31.393700
Priscilla
pythondev_help_Priscilla_2019-05-01T18:58:31.393700
1,556,737,111.3937
21,851
pythondev
help
Python creates the object for you and then calls `__init__` for you to flesh it out, but it's already created by the time you get it, so you don't have to return anything.
2019-05-01T18:59:05.394500
Sasha
pythondev_help_Sasha_2019-05-01T18:59:05.394500
1,556,737,145.3945
21,852
pythondev
help
if i need to pass the list of serial numbers which are global, how do i do that if I cannot pass a function to a class?
2019-05-01T20:20:43.394900
Priscilla
pythondev_help_Priscilla_2019-05-01T20:20:43.394900
1,556,742,043.3949
21,853
pythondev
help
There are some elements to this code which are fairly messed up... You really shouldn't be defining functions inside `try` blocks or inside `for` loops.
2019-05-01T20:30:06.396700
Sasha
pythondev_help_Sasha_2019-05-01T20:30:06.396700
1,556,742,606.3967
21,854
pythondev
help
alright, taking it out
2019-05-01T20:32:27.397400
Priscilla
pythondev_help_Priscilla_2019-05-01T20:32:27.397400
1,556,742,747.3974
21,855
pythondev
help
I unfortunately have to run for a few hours, but hopefully other folks will be able to help further.
2019-05-01T20:34:30.397600
Sasha
pythondev_help_Sasha_2019-05-01T20:34:30.397600
1,556,742,870.3976
21,856
pythondev
help
Beginner in python, need help with some scripts to pull web data using requests from 5 links, then print all links text. Any help?
2019-05-01T23:44:09.400300
Donna
pythondev_help_Donna_2019-05-01T23:44:09.400300
1,556,754,249.4003
21,857
pythondev
help
Where are you running into trouble?
2019-05-01T23:49:14.400500
Sasha
pythondev_help_Sasha_2019-05-01T23:49:14.400500
1,556,754,554.4005
21,858
pythondev
help
Can you show us the code you are having trouble with?
2019-05-01T23:51:37.400800
Mildred
pythondev_help_Mildred_2019-05-01T23:51:37.400800
1,556,754,697.4008
21,859
pythondev
help
Sure! I tried to piece info together and it's horrible code.
2019-05-01T23:53:11.401700
Donna
pythondev_help_Donna_2019-05-01T23:53:11.401700
1,556,754,791.4017
21,860
pythondev
help
is this the same script you also just asked about in introductions and random channels?
2019-05-01T23:53:48.402500
Mildred
pythondev_help_Mildred_2019-05-01T23:53:48.402500
1,556,754,828.4025
21,861
pythondev
help
Yes.
2019-05-01T23:53:54.402700
Donna
pythondev_help_Donna_2019-05-01T23:53:54.402700
1,556,754,834.4027
21,862
pythondev
help
I figured this was the place to get some help.
2019-05-01T23:54:16.403500
Donna
pythondev_help_Donna_2019-05-01T23:54:16.403500
1,556,754,856.4035
21,863
pythondev
help
ok, lets keep it to one channel for now :slightly_smiling_face: Click on the plus to the left of the window and paste in a code snippet so we can take a look at what you are doing
2019-05-01T23:54:33.403800
Mildred
pythondev_help_Mildred_2019-05-01T23:54:33.403800
1,556,754,873.4038
21,864
pythondev
help
Got it!
2019-05-01T23:56:32.404100
Donna
pythondev_help_Donna_2019-05-01T23:56:32.404100
1,556,754,992.4041
21,865
pythondev
help
here's the goal
2019-05-01T23:57:03.404300
Donna
pythondev_help_Donna_2019-05-01T23:57:03.404300
1,556,755,023.4043
21,866
pythondev
help
You'll want to write a Python program to: (1) for each of the first five links read the html text content of each website (that is to say, read the three character "code" for each), (2) concatenate the five parts together in order (first website part + second website part + ...), (3) append the resulting 15 character "code" to the validation url in the place of the string "&lt;clock pts&gt;", and (4) read the html text content of the website with the derived url.
2019-05-01T23:57:09.404500
Donna
pythondev_help_Donna_2019-05-01T23:57:09.404500
1,556,755,029.4045
21,867
pythondev
help
None
2019-05-01T23:59:25.404700
Donna
pythondev_help_Donna_2019-05-01T23:59:25.404700
1,556,755,165.4047
21,868
pythondev
help
That's how far i got.
2019-05-01T23:59:56.405200
Donna
pythondev_help_Donna_2019-05-01T23:59:56.405200
1,556,755,196.4052
21,869
pythondev
help
not my strong suit, but i would imagine you have to do something with webscaping, probably the request module
2019-05-02T00:00:56.406000
Mildred
pythondev_help_Mildred_2019-05-02T00:00:56.406000
1,556,755,256.406
21,870
pythondev
help
Yep, I'd say your next step is reading some of the documentation for the `requests` library.
2019-05-02T00:01:42.407100
Sasha
pythondev_help_Sasha_2019-05-02T00:01:42.407100
1,556,755,302.4071
21,871
pythondev
help
something like: For each in urls: text.append(request(url[each])
2019-05-02T00:01:48.407300
Mildred
pythondev_help_Mildred_2019-05-02T00:01:48.407300
1,556,755,308.4073
21,872
pythondev
help
A simple issue that will probably catch you by surprise is that you need commas between your URLs to make a list, as right now the strings will be appended into one large one.
2019-05-02T00:02:45.408200
Sasha
pythondev_help_Sasha_2019-05-02T00:02:45.408200
1,556,755,365.4082
21,873
pythondev
help
None
2019-05-02T00:11:30.408400
Donna
pythondev_help_Donna_2019-05-02T00:11:30.408400
1,556,755,890.4084
21,874
pythondev
help
Here is one of my first trys an hour ago.
2019-05-02T00:12:27.409300
Donna
pythondev_help_Donna_2019-05-02T00:12:27.409300
1,556,755,947.4093
21,875
pythondev
help
Cool. Did that work?
2019-05-02T00:13:23.409800
Sasha
pythondev_help_Sasha_2019-05-02T00:13:23.409800
1,556,756,003.4098
21,876
pythondev
help
Yes, but I need to all all 5 links and responses, then concat all of them
2019-05-02T00:13:57.410600
Donna
pythondev_help_Donna_2019-05-02T00:13:57.410600
1,556,756,037.4106
21,877
pythondev
help
I'm not sure how much of a beginner you are. Are you familiar with `for` loops?
2019-05-02T00:14:31.411100
Sasha
pythondev_help_Sasha_2019-05-02T00:14:31.411100
1,556,756,071.4111
21,878
pythondev
help
I'll say I know nothing. Like watched 10 videos, fresh off the python boat.
2019-05-02T00:16:32.412100
Donna
pythondev_help_Donna_2019-05-02T00:16:32.412100
1,556,756,192.4121
21,879
pythondev
help
Read this: <https://realpython.com/python-requests/>
2019-05-02T00:17:09.412600
Donna
pythondev_help_Donna_2019-05-02T00:17:09.412600
1,556,756,229.4126
21,880
pythondev
help
i would be suprosed if you didnt know loops after watching 10 videos. Outside of what a variable is, its right up on the list
2019-05-02T00:17:36.413500
Mildred
pythondev_help_Mildred_2019-05-02T00:17:36.413500
1,556,756,256.4135
21,881
pythondev
help
Okay, the simplest form of a `for` loop allows you to repeat a section of code for a sequence of values. For instance: ```nums = [1, 2, 3] for x in nums: print(x)``` would output: ```1 2 3```
2019-05-02T00:18:30.414400
Sasha
pythondev_help_Sasha_2019-05-02T00:18:30.414400
1,556,756,310.4144
21,882
pythondev
help
So you can use this to execute your `requests` code for each URL in your list.
2019-05-02T00:19:01.414900
Sasha
pythondev_help_Sasha_2019-05-02T00:19:01.414900
1,556,756,341.4149
21,883
pythondev
help
Appending strings together just uses the `+` operator, like `"a" + "b"` produces `"ab"`.
2019-05-02T00:19:44.415600
Sasha
pythondev_help_Sasha_2019-05-02T00:19:44.415600
1,556,756,384.4156
21,884
pythondev
help
I feel that I should tell you that the cybersecurity program you're enrolled in is likely to get exponentially more difficult than this sort of initial exercise.
2019-05-02T00:21:24.417100
Sasha
pythondev_help_Sasha_2019-05-02T00:21:24.417100
1,556,756,484.4171
21,885
pythondev
help
Correct but this task outside of my normal "work"
2019-05-02T00:23:05.418000
Donna
pythondev_help_Donna_2019-05-02T00:23:05.418000
1,556,756,585.418
21,886
pythondev
help
I'm using these small tasks to learn python
2019-05-02T00:23:40.418700
Donna
pythondev_help_Donna_2019-05-02T00:23:40.418700
1,556,756,620.4187
21,887
pythondev
help
Gotcha.
2019-05-02T00:24:31.419000
Sasha
pythondev_help_Sasha_2019-05-02T00:24:31.419000
1,556,756,671.419
21,888
pythondev
help
`for` loops are important to understand. Haven't seen exactly this video, but each time I watch a Corey Schafer tutorial I feel I go from being painfully ignorant about a topic (ie TDD) and 15 minutes later, I understand the basic concepts. <https://www.youtube.com/watch?v=6iF8Xb7Z3wQ>
2019-05-02T00:28:03.422100
Conchita
pythondev_help_Conchita_2019-05-02T00:28:03.422100
1,556,756,883.4221
21,889
pythondev
help
Oh yeah — he is great. I have been following him for quite long now, and recently started supporting him on Patreon too!
2019-05-02T00:35:38.423000
Raguel
pythondev_help_Raguel_2019-05-02T00:35:38.423000
1,556,757,338.423
21,890
pythondev
help
Awesome!
2019-05-02T00:40:40.423300
Conchita
pythondev_help_Conchita_2019-05-02T00:40:40.423300
1,556,757,640.4233
21,891
pythondev
help
Hello everyone, In my react frontend I used axios to send POST request when user click log in. In backend, while authenticating user using django I set cookie using response.set_cookie['token'] =token where token is JWT and return response. I have printed the cookie in diango and it shows me the Set_Cookie variable on django console. It is confirm that cookie has been set successfully. But when I see the network section in browser on localhost:3000 it doesn't show cookie. I also printed the response as a result in react on console. It also doesn't show any cookie variable in response object. How to resolve this problem? I stucked here. Lot of work to do. Thanks and Regards.
2019-05-02T00:53:08.424200
Yolande
pythondev_help_Yolande_2019-05-02T00:53:08.424200
1,556,758,388.4242
21,892
pythondev
help
Can you show the actual code of your view on Django? From what you say it's hard to figure out what is at fault
2019-05-02T02:10:04.425000
Christina
pythondev_help_Christina_2019-05-02T02:10:04.425000
1,556,763,004.425
21,893
pythondev
help
Hi, I'm using DRF and I have an issue with it's token mechanism - it's only create a single token for user without a refresh token. I'm need to have multiple tokens with refresh token since I'm creating a native react app. I'm been looking for something like that for a while and it seems strange to me that there is not something like that: multiple tokens for users with refresh tokens. Any suggestions?
2019-05-02T04:48:58.427500
Rayford
pythondev_help_Rayford_2019-05-02T04:48:58.427500
1,556,772,538.4275
21,894
pythondev
help
Isn't it basically oauth ? or some stuff like that? You can just create your own authentication, though :slightly_smiling_face: it's all in the docs
2019-05-02T05:25:23.428200
Christina
pythondev_help_Christina_2019-05-02T05:25:23.428200
1,556,774,723.4282
21,895
pythondev
help
But i assume that it's possible. somehow. i dont really know on the top of my head
2019-05-02T05:25:40.428700
Christina
pythondev_help_Christina_2019-05-02T05:25:40.428700
1,556,774,740.4287
21,896
pythondev
help
oAuth is good when you want to delegeate user permission for multiple apps. In this case I have only two - desktop and react native - so I think it's an over kill
2019-05-02T05:57:27.429900
Rayford
pythondev_help_Rayford_2019-05-02T05:57:27.429900
1,556,776,647.4299
21,897
pythondev
help
But I think we'd create it and contribute it back
2019-05-02T05:57:45.430300
Rayford
pythondev_help_Rayford_2019-05-02T05:57:45.430300
1,556,776,665.4303
21,898
pythondev
help
Here is the code screen shot
2019-05-02T08:02:17.431200
Yolande
pythondev_help_Yolande_2019-05-02T08:02:17.431200
1,556,784,137.4312
21,899
pythondev
help
Hi guys, It's a beginner's question: ``` x = 5 x is referring to an int 5 object ``` What does it mean? ( x is an instance of int class and it is initialised with value 5?)
2019-05-02T08:05:09.433900
Orlando
pythondev_help_Orlando_2019-05-02T08:05:09.433900
1,556,784,309.4339
21,900
pythondev
help
It means that somewhere in your heap memory there is an object of type `int` and value `5`, and that there is a pointer `x` that points to that memory. It's often called a "name" that points to a "box". You can have another "name" pointing to the same "box" like this: `y = x`
2019-05-02T08:07:59.435600
Chester
pythondev_help_Chester_2019-05-02T08:07:59.435600
1,556,784,479.4356
21,901
pythondev
help
Since `y = x` only creates another name to the same "box", the object itself (`5`) isn't copied - both names point to the same object in memory
2019-05-02T08:08:46.436600
Chester
pythondev_help_Chester_2019-05-02T08:08:46.436600
1,556,784,526.4366
21,902
pythondev
help
some fun trivia about those boxes: ``` &gt;&gt;&gt; x = 256 &gt;&gt;&gt; y = 256 &gt;&gt;&gt; x is y True &gt;&gt;&gt; x = 257 &gt;&gt;&gt; y = 257 &gt;&gt;&gt; x is y False ``` <https://docs.python.org/3/c-api/long.html#c.PyLong_FromLong>
2019-05-02T08:13:21.437000
Karoline
pythondev_help_Karoline_2019-05-02T08:13:21.437000
1,556,784,801.437
21,903
pythondev
help
Hello there. I'm new to python and my supervisor asked me to reproduce a plot, using equations and data from various papers. I wrote a code, but it doesn't work at all. I'd like to know if I'm making code mistakes or there are problems with the equations I'm using. Thank you in advance for your help :slightly_smiling_face:
2019-05-02T08:41:28.439600
Gertrud
pythondev_help_Gertrud_2019-05-02T08:41:28.439600
1,556,786,488.4396
21,904
pythondev
help
you're getting a "ValueError: math domain error" at line 41 i = 1 for item in x_data: y_data[i]=f(x_data[i]) i=i+1
2019-05-02T08:50:44.440100
Nola
pythondev_help_Nola_2019-05-02T08:50:44.440100
1,556,787,044.4401
21,905
pythondev
help
if you trying to iterate over your x_data then you would need to use: for item in x_data: print(item) or something like : y_data[i]=f(item[i])
2019-05-02T08:54:45.440300
Nola
pythondev_help_Nola_2019-05-02T08:54:45.440300
1,556,787,285.4403
21,906
pythondev
help
I get that error, but in line 37, when I define the Integral. I suppose (not sure) that it's due to the fact that cosmax, which is a cosine, isn't below 1 for all values. So I decided to remove that cosine and put as an extreme of the integral a random angle. I don't see anymore that error, but I got: IntegrationWarning: The occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. The error may underestimated.
2019-05-02T08:55:18.440500
Gertrud
pythondev_help_Gertrud_2019-05-02T08:55:18.440500
1,556,787,318.4405
21,907
pythondev
help
can you paste in a traceback?
2019-05-02T08:56:39.440800
Nola
pythondev_help_Nola_2019-05-02T08:56:39.440800
1,556,787,399.4408
21,908
pythondev
help
runfile('C:/Users/simon/OneDrive/Documents/University/Thesis/Python/exercise donnie.py', wdir='C:/Users/simon/OneDrive/Documenti/University/Thesis/Python') C:/Users/simon/OneDrive/Documents/University/Thesis/Python/exercise donnie.py:31: RuntimeWarning: invalid value encountered in double_scalars return 2*math.pi*math.sin(theta)*p*sigmain*(1-xR)**D1*math.exp(-D2*xR)*(D3*math.sqrt(s)**D4*math.exp(-D5*pT)+D6*math.exp(-D7*pT*pT)) C:/Users/simon/OneDrive/Documents/University/Thesis/Python/exercise donnie.py:37: IntegrationWarning: The occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. The error may be underestimated. integral = integrate.quad(g,0,math.acos(cosmax),args=x) This is the error after I remove the cosine
2019-05-02T09:03:21.441000
Gertrud
pythondev_help_Gertrud_2019-05-02T09:03:21.441000
1,556,787,801.441
21,909
pythondev
help
<@Tyler> <#C080T8XT2|job_board>
2019-05-02T09:18:36.443700
Chester
pythondev_help_Chester_2019-05-02T09:18:36.443700
1,556,788,716.4437
21,910
pythondev
help
Thanks <@Chester>
2019-05-02T09:19:06.444200
Tyler
pythondev_help_Tyler_2019-05-02T09:19:06.444200
1,556,788,746.4442
21,911
pythondev
help
None
2019-05-02T09:32:22.444600
Nola
pythondev_help_Nola_2019-05-02T09:32:22.444600
1,556,789,542.4446
21,912
pythondev
help
Hi guys, maybe it’s a dumb question, but do you know if it is possible to use a shared `__init__.py` file across modules?
2019-05-02T10:05:10.445700
Alicia
pythondev_help_Alicia_2019-05-02T10:05:10.445700
1,556,791,510.4457
21,913
pythondev
help
an `__init__.py` file just says to the interpreter that “hey, this is a python package, not a regular directory/folder” and allows for imports
2019-05-02T10:06:15.446600
Hiroko
pythondev_help_Hiroko_2019-05-02T10:06:15.446600
1,556,791,575.4466
21,914
pythondev
help
if you have logic in `__init__.py` that you want shared, pull it out into a `something.py` file and you can import it into modules
2019-05-02T10:07:23.447700
Hiroko
pythondev_help_Hiroko_2019-05-02T10:07:23.447700
1,556,791,643.4477
21,915
pythondev
help
hi <@Hiroko>, I thought that __init__.py could also be used to execute some logic at module import phase, as the first action… In particular my logic is the following: ``` # This piece of code is needed to fix a bug in matplotlib on MacOs # see: <https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python> # import matplotlib.pyplot as plt if sys.platform == 'darwin': import matplotlib if 'matplotlib' in sys.modules: matplotlib.use('TkAgg') ``` so what you say is that I should move that in a specific python file, and then import that file in every module?
2019-05-02T10:13:23.450700
Alicia
pythondev_help_Alicia_2019-05-02T10:13:23.450700
1,556,792,003.4507
21,916
pythondev
help
I think the kind of thing you're showing here is ok. It's basically import configuration
2019-05-02T10:15:58.451700
Bethany
pythondev_help_Bethany_2019-05-02T10:15:58.451700
1,556,792,158.4517
21,917
pythondev
help
Matplotlib has to do this kind of stuff since it depends on system renderers/drawers/whatever it's called
2019-05-02T10:17:01.453200
Bethany
pythondev_help_Bethany_2019-05-02T10:17:01.453200
1,556,792,221.4532
21,918
pythondev
help
:yep:
2019-05-02T10:17:05.453300
Hiroko
pythondev_help_Hiroko_2019-05-02T10:17:05.453300
1,556,792,225.4533
21,919
pythondev
help
``` import matplotlib if 'matplotlib' in sys.modules: ``` This `if` seems useless
2019-05-02T10:17:54.453700
Chester
pythondev_help_Chester_2019-05-02T10:17:54.453700
1,556,792,274.4537
21,920