« first day (3125 days earlier)      last day (1824 days later) » 

1:00 PM
locationTaxonomy is a list of dicts... that - guess what... only ever gets looked up by it's name...
 
wince
 
and a variable named l is fantastic... and the casing... it's not even getLocationTaxonomy (with a capital T!)... it's... sighs
and a bare except... I'm so surprised!
 
Just burn it
 
Ooo... ooo... and this one's good... some_list = ['a', 'b', 'c', 'd', 'e', 'etc...']; then further down... for item in some_list: if item == 'a'... elif item =='b'... etc... etc...
600 lines... of which 2/3rds are useless or redundant... happy, happy, happy, joy, joy, joy...
 
> small code review
my condolences
 
1:08 PM
when he's done reviewing only small code will be left
 
as it should
one of the first things I did at my last org was putting "stop writing classes" at the top of the onboarding page
 
Ooo, and not using raw-strings when specifying window style paths...
 
backslash or forward?
nevermind, has to be back
 
@Arne did they all turn around and go... "Why? You just wrote it!?" :p
 
I feel I'm missing a pun here o.O
 
1:11 PM
it appears they've sometimes used forward-slashes and sometimes black-slashes... although I think most windows systems these days will take forward-slashes in file paths, so you can get away with it... (not sure if that applies accessing a network resource/etc... though)
@Arne not really a pun... just you're asking people to stop writing classes... by writing down an instruction with "writing classes" in it... you hypocrite :p
 
I thought forward slashes were categorically fine
 
never experimented - was just thinking about unc paths or whatever they're called
 
@RaphX I continually lowered my expectations on this. I can't seem to avoid the double pass
 
@roganjosh means?
 
I think this is along the lines of what you wanted
ratio was a poor choice of name, again, but I'm good at changing my mind on how to approach things :P
 
1:18 PM
@JonClements ha, then the refined version should probably be: "If you're from Java, stop writing classes"
 
That gives a mean Levenshtein distance across the group, and taking the minimum will give you what you wanted
 
@Arne That's now just being discriminatory against a whole country! :)
 
But I really dislike the two cycles of all the data to get it. I assume I will be bested on that; if I have interpreted the question correctly
 
You've got an "-ite" there and and some sort of "-ism" - what else you going for @Arne :p
@roganjosh Can you use a kind of ever decreasing approach, sort of like:
stuff = set()
while stuff:
    val = stuff.pop()
    matches = {el for el in stuff if some_match_func(val, el)}
    stuff.difference_update(matches)
 
"-ist" probably?
 
1:23 PM
@JonClements I will just concede in the face of superior lawyer-bility
 
@Arne hey... just finished doing a rather horrible code review... I was still in that mindset :p
 
@JonClements I'm not sure I can pop results out because I've already done groupby, but I might be able to pass the series and its length to a function
 
ahh... does it definitely have to be based in pandas... when it comes to these kind of operations, I find it's generally best to not try hard to panda it :p
 
It almost certainly could be consolidated into a single pass, but I think I'd look a bit clumsy doing it without more time to ponder it
It isn't even a panda-ism. I resign; I could not find a vectorized way :'(
 
Thanks! @roganjosh
 
1:33 PM
we love pandas... it's just a shame they don't tend to (make) love (to) each other... :p
 
people calling pandas panda is one of my major pet peeves
 
@AndrasDeak that's shorthand for the SO canned close-reasons: Off-topic > irreproducible / typo / syntax error or Off-topic > debugging help. What would you prefer I say?
 
@Andras umm.... mine is probably "scrapping" instead of "scraping"... but that's definitely close :)
 
@smci I thought the typo was the shorthand and syntax error was explanation. Because you already mentioned a non-syntax error today :P
 
@AndrasDeak Re closing that one, I personally agree with you, but is that consensus (even just in this tag?) I'd seen some people suggesting otherwise on the never-ending existential discussion about 'How welcoming...'
 
1:34 PM
"I want to scrap x" really gets the blood pressure up
 
@smci Some people will suggest anything, even some (ex-)employees. Still, nobody official has ever said that we should stop moderating posts based on their objective merits. Not an issue of welcoming. How you tell them their question is off-topic is when welcoming comes into play. If it's crap, close and downvote, no matter who asked and why.
@roganjosh I want to scrap your use of "panda-ism"
 
Sure, pandas-ism reads much better
 
yes!
you don't even need the hyphen :P
 
pandasism. Sounds like a terrible disease!
 
it has already spread onto SO
 
1:39 PM
Anything I say in reply to that will sound like some crappy tagline
 
@AndrasDeak I agree with "If it's crap, close and downvote, no matter who asked and why", I was just asking here to confirm before I did. As to whatever the emergent consensus on the never-ending existential discussion about 'How welcoming...', I don't have the time for all that drama, and I see a lot of plain stupid comment from people who claim to be senior or knowledgeable, so if any of you guys want to decode it for the rest of us, please do...
 
"Mobilise Room 6" or "that's what we're here for" etc.
 
... Like don't assume I know which posters are SO employees, and ex-SO-employees, and why, and which ones have fancy titles but are to be ignored.
@AndrasDeak I can't understand what you mean by that; my post I quoted you clearly said "we would want something like range(11, 30, [2,4,2,2]) or range(11, 30, iter([2,4,2,2])) except that isn't legal syntax". What's your point with "already mentioned a non-syntax error today"? If that's the post you're referring to, you're wrong.
 
you said "... except that isn't legal syntax" where it clearly is ;) And when you alter mentioned syntax errors again (because of the close reason) it just stood out for me. Not a significant thing at all, feel free to ignore it
 
..unless you want to nitpick that range(11, 30, [2,4,2,2]) throws TypeError: 'list' object cannot be interpreted as an integer. I said it isn't legal syntax for what I was trying to do, which is 100% correct statement. I did not claim "it throws a SyntaxError"
 
1:45 PM
yeah, my point was that it's perfectly fine syntactically
@smci employees are people with diamonds who aren't elected moderators, notably Tim Post and Shog9. And an ex-employee wrote the original incendiary Blog Post of Welcomingness
everyone has an opinion on meta but I'm pretty certain there's very strong consensus that off-topic is still off-topic
 
I have to assume you think you're being witty or helpful, but it doesn't come across to me as either, it's plain unwelcoming, and this isn't the first time we've had this discussion. Could you please phrase yourself more positively? I repeat that range(11, 30, [2,4,2,2]) isn't legal syntax for what I was trying to do, namely a range() with step is variable (a list or iterator) . Whether it's legal syntax for something other than what I was trying to do, is utterly irrelevant.
 
okay
 
okay we're cool
 
if it helps, i'd be misled by the phrase "legal syntax", i expect a code that isnt legal syntax to raise errors. Perhaps a rephrase to "does not give desired output" or something along those lines.
 
jjj
hi, is there a list of python 'ought to be canonical' questions?
 
1:52 PM
@jjj there's a list of canon
 
note that ^ that is not official, nor complete
 
jjj
duh, I had a look there and could'nt fid it, thanks
@AndrasDeak yes, I know
 
But the caveats Andras said still apply
 
@smci all you need to know that the whole welcoming initiative is about communication. How you comment, how you answer. Closing and voting has little effect in this regard. The one edge case is the custom close reason, where you can try being nice while explaining why you're closing a blatantly off-topic question.
 
@ParitoshSingh "i expect a code that isnt legal syntax to raise errors" And yes it does; I already stated twice it raised a TypeError: 'list' object cannot be interpreted as an integer. Post it and see for yourself. That's not a case of "[works but] does not give desired output" - it's an outright error.
 
1:56 PM
then that sounds fine to me
 
cbg
 
cbg
 
@AndrasDeak Yes, I figured out that was the consensus among SO users after reading pages of never-ending angsting and people invoking inclusivity to make all sorts of wild claims. (And in this question's case, I left a constructive comment when I VtC, as I often try to do; either that or suggest a related or dupe link, or doc link, or github issue, or external blog.)
 
Arhghgh... it's 3pm and it feels like it's 3am :(
 
@smci then you needn't worry about being welcoming
note that the whole welcoming ordeal started with "people invoking inclusivity to make all sorts of wild claims"
 
2:02 PM
@AndrasDeak Oh he became ex-employee? I couldn't tell, or how soon after. Does that mean his post is still 'official thinking', or more like Nixon "All prior statements are inoperative"?
 
What does it matter?
 
@smci yeah, he left not long ago, for unknown but unrelated reasons
the company never said that anything in the blog post was wrong, it's still canon (as much as a blog post can be)
relevant meta meta.stackexchange.com/questions/325178/… regarding Jay leaving
 
@AndrasDeak Well not 100% of the time, sometimes senior users genuinely are plain rude, hostile, and/or post comment-storms disparaging the user, their level of effort, level of knowledge, ability to communicate, insinuating post should be downvoted/closed/deleted, diss-words like 'homework' etc. I've personally seen it happen plenty, and it's one reason SO got a bad reputation. But we retread what was discussed.
@AndrasDeak Ah, thanks for the link. Am I supposed to upvote or downvote that announcement if I'm happy he left?
 
Yes, the intention of Jay was fine and solid, but the way he put it forward was full of fallacies and false assumptions
Well, "full of" is an exaggeration, still I was very much displeased with it. It set off a fight for a good cause on a very bad footing.
 
@AndrasDeak sadly it did a fairly good job at polarising the community
 
2:10 PM
@AndrasDeak Perhaps, but it doesn't matter to him how much grief he caused, he gets to posture as inclusivity champion and burnish his credentials for future corporate jobs. I've seen it happen.
 
He's not evil, he was just partly wrong about the situation on SO.
or maybe not even wrong, just wrong in how he explained it, but if so he never bothered to try and clarify despite major pushback from the community
 
@AndrasDeak It's very possible to cause damage while building a 'personal brand' posturing as inclusivity champion. I've seen it happen.
 
Just spent about 100 times as long as I should have to figure out how to get the Enterprisey Business Solution software to access a text file at C:/scripts. Hint: put C:/scripts/yourfile.txt in the "file path" field.
Just because the "browse..." button refuses to navigate outside of the "C:/program files/Enterprisey Business Solution/user profiles" directory, doesn't mean you can't type other things into the text box
 
... Windows
It doesn't (or shouldn't) refuse, the directories are on the left
 
1 demerit to Stack Overflow for sending me on a wild goose chase involving UNC paths
 
2:18 PM
Somewhat akin, do any of you care about the annual SO Developer Survey? I think the methodology sucks, it depends entirely on self-reporting and that from a self-selected subset, so someone can self-describe as 'Python expert' (or indeed in 20 languages), and we have no way to verify if they're full of shit or not. Also, job titles and 'years on SO' are not objective ways to determine people's skill levels either. Rep accrual and tag badges are also skewed metrics...
 
its probably the most comprehensive source of data aggregation for devs regardless
i dont see a good way around self reporting specifically, and the insights derived from the survey seem to have some rhyme or reason, enough to atleast assure ourselves that it isnt completely off.
 
...they don't reflect users who come here but don't actively post questions or answers, and they in part reflect people becoming adept at maximizing rep accrual for minimal effort. For example I spend tons of time closing questions as dupe, dupe-searching, and rewriting other people's questions to make them better/clearer/more canonical, and that doesn't show up in any metrics. Also tag janitorial. Perhaps I just need my head examined.
 
Yes, I care about the survey. It's also the only survey that I now identify as "gay" on rather than "prefer not to say" because they want to drive some agenda on marginalisation. And I don't feel marginalised. Maybe I'll see differently after saying this. I suspect not.
 
@roganjosh Ok, it's useful for demographic data. But not as a halfway-objective survey of programming ability or knowledge. I don't care whether someone self-describes as 'CXO' or 'Entrepreneur' or 'Data Janitor' or 'Software Engineering Intern'.
 
2:26 PM
I'm vaguely optimistic that everything will work out alright in the end and in the meantime I'll just keep scolding people for doing x = tkinter.Entry().pack() like I always have
 
Sure, I'm just saying that I give records to the best of my knowledge. We can't rely on people to give accurate feedback, but what better method is there?
 
(Advertisers will care. But I can't see that internally it measures anything objective.)
 
I'm sure they use it for Stackoverflow Jobs
 
> In the east there is a shark which is larger than all other fish. It changes into a bird whose wings are like clouds filling the sky. When this bird moves across the land, it brings a message from Corporate Headquarters. This message it drops into the midst of the programmers, like a seagull making its mark upon the beach. Then the bird mounts on the wind and, with the blue sky at its back, returns home.

The novice programmer stares in wonder at the bird, for he understands it not. The average programmer dreads the coming of the bird, for he fears its message. The master programmer cont
 
Wut
 
2:29 PM
Let me explain.
> In the east there is a shark which is larger than all other fish. It changes into a bird whose .....
 
@roganjosh In my 9 years on SO I always refuse to take the survey. The methodology is plain broken. Zero attempt to link it to profiles, to verify self-reported claims even in aggregate e.g. "X% of people who claim to have 5+ years in Python have an SO gold badge, vs Y% in PHP or Z% in Ruby" or "Here is a table of how many questions Python users ask and answer per year, broken out by self-reported seniority and by SO rep level (both in [python] tag, and total)" Now those would be insights.
 
Every surveys' methodology is broken
 
why though, SO badges and tags are also not good indicators for dev skills or interests either. Its a broken system one way or another
 
It's just a matter of how much broken you can accept
 
2:34 PM
There's at least 1 gold badger that frequents this room and I'd not take advice from them for, let's say, £100s. I can probably be bought if the impending explosion wasn't my fault :P
 
@OldTinfoil No honestly, what's your comment on what I just proposed? Just link the bloody responses to the profiles, already, anonymize, bin and aggregate. Then we get actual real insights. Is that so hard? And/or pass on the aggregated anonymized data to people like us in each of the major tags, to see what topic-specific insights we can derive and what they should measure next year.
 
Badges, stars, upvotes, when SO was new vs now, there's a pretty big difference right there. Technologies that didn't pull a lot of people when SO was established might be misrepresented even worse than a self-survey would.
 
Okay, let me put it another way @smci - if 1% of people incorrectly rate their skill levels, how does it affect the results? If 100% incorrectly rate their skill levels, how does it affect the results?
If a small enough contingent does it, that essentially becomes the noise / error in the methodology. If the vast majority self identify incorrectly, then either the survey has ballsed up, or the entire workplace defines that term as something else.
 
@ParitoshSingh There have been some scurrilous suggestions in investigating how claimed experience in one tag can actually be slightly negative for other tags, e.g. do PHP or JS users tend to know less about algorithms, or OO decomposition, or recursion, or big-O.
 
If the survey is an extension of Stack Overflow jobs - where people self identify their own worth on their CVs because there is no other way (prior to calling people up for references) then it is fit for purpose
 
2:42 PM
@OldTinfoil For real? If 90+% of SO users don't respond, and 100% of those that do, incorrectly rate their skill levels, then the survey is garbage, except for the demographic section, the user feedback (which we maddeningly can't correlate to actual levels of either knowledge, ability, education, English fluency, SO participation, compensation or seniority). And we can draw a pretty map of where everyone lives on the globe. But useless for pretty much every other purpose.
 
What purpose would you use it for that isn't also at the mercy of human behaviour?
 
@roganjosh Repeating myself from above: Just link the bloody responses to the profiles, already, anonymize, bin and aggregate. Then just maybe we start to get actual insights.
 
Right, and I've just said that there's a gold badger in this room (not now) that I really don't think has any reason to be
 
I know that person :P
 
i mean, i'll say that its not a bad idea. but is it better than a self survey, would not really be possible to establish one way or another. Frankly, it might be worse, and then would the effort be worth it? That's a tricky call to take.
 
2:45 PM
You're giving too much weight to SO profiles. Arne would do really well with rep if he chose to answer more, for example. Rep is arbitrary
 
My most recent gold badge is for asking "how do I run this program?". I received it not because I am smart, but because I am dumb.
 
@OldTinfoil Do you have reason to believe one of the survey's primary purposes is as QA/feedback on participants in SO Jobs? or are you just conjecturing? What about all the incessant talk of 'making SO better', however that's defined? Is it pretty much just CSR and token 'listening', in the corporate vernacular?
 
Frankly, if tied to stats on profiles, which is basically a gamification of "helping", then wouldn't it misrepresent in favour the "gamers" of the system? Like, its worth exploring, but there's plenty of scenarios where it might be worse off than a self survey. Self surveys might have their faults, but in many instances, we accept them as the best "crappy" solution we have. Because the downsides to other approaches might be worse, and better hidden.
 
@roganjosh Rep is mostly arbitrary, but posting stupid fanboy drivel about Jon Skeet should be a death-penalty offence. It 'improves' the site as much as 'I need code to do X, it's due tomorrow, give me teh codez'.
 
And if it gets upvoted?
 
2:51 PM
@smci How many millions of users does SO have? Even if it's just 10%, then that's shy of a million responses. Hardly an insignificant number. And if 100% of those mis-identify, then that actually tells you something about how people identify their skill levels.
 
SO rep is, at best, an indication
 
And my comments about Jobs is purely conjecture on my behalf.
 
Aran-Fey throws his away. Arne deserves more but doesn't interact on main enough. There's someone with a gold badge in Python that comes in the room and is seriously lacking. You want this to feature as something we can take results from, as more accurate than self-reporting?
 
as a trend, i'm willing to bet SO rep is more tightly correlated with the age of the account rather than a person's so called development skills. (and i could be wrong, but meh.)
 
@OldTinfoil (I mean obviously they have an eye on revenue, advertiser demographics, recruiter demographics. That is to be expected.)
 
2:56 PM
To be honest - rep is fairly inaccurate method of measuring capability. I only tend to answer questions that I have the same question to, and didn't find a satisfactory answer.
As a result, I still haven't smashed the 1000 points despite being on here for well over 5 years
 
@roganjosh if which gets upvoted, Jon Skeet fanboy drivel? Have you never seen questions on SO get derailed with nerdy in-group banter, or any stupid form of herd behavior? Give them a chatroom on Meta if they must post that stuff somewhere. Ban it elsewhere.
 
(half-wishing this conversation was happening in a chatroom on Meta right now...)
 
I don't Meta.
Meta is something that happens to other people
4
 
(wait, other users can read my parentheticals? I thought these were asides to the audience.)
 
yup; we can read it Kevin
 
3:00 PM
((at least I know I'm safe inside double parens))
 
Who said that?
 
Only the wind, I'm sure.
 
(Audience: Double parens are safe. It was just a coincidence)
 
To be fair Kevin, that's how I found out your true name.
Right - gonna dash.
 
Hmm, probably shouldn't have disclosed my SSN and mother's maiden name as well
 
3:02 PM
@ParitoshSingh People you're misunderstanding what I'm saying. As I tried to say above, the survey gives us a golden opportunity to cross-correlate claimed level of experience (by tag) vs SO rep level vs SO participation metrics (visits, questions in specific tag, answers, votes, comments) vs self-reported education level vs self-reported job title vs compensation. That investigation is what would generate insights!
 
Oh, i dont disagree with the "exploration" of the idea.
 
I just think you want to be miffed about something tbh.
 
But i don't quite agree with it giving a "Better" insight, because there would be no good way to trust the cross correlation in case of discrepancy.
in case they dont agree, well, was the original survey wrong, or our metric for cross examination?
 
so if someone claims to be a Python wizard, or SQL intermediate, or Java beginner, see how their actual measurable verifiable real-world behavior corresponds to those other things. For example, why (measurable reasons) do users join, why do they leave, what's good, what's bad, in each tag, at each experience level.
 
The only scenario in that case where we can perhaps trust in our survey would be if the two systems agree.
 
3:06 PM
@ParitoshSingh Currently the survey seems to make zero objectively verifiable measurements. That makes it garbage, except for self-reported demographics. It's infuriating how little effort they make to crosscheck user claims.
 
That i can understand, wont deny it. But the issue still remains, objectively verifiable measurements dont really exist. And if you trust a "noisy" system as objective, it may end up worsening the insights you get.
 
As Paritosh says, which metric is correct?
 
@ParitoshSingh and RobertGrant It's not a binary 'agree 100%' or 'disagree 100%'. What if we get insights like "The average newbie Java programmer on SO is from South Asia and has X years of college, and tends to have worse experiences when posting their first n questions, for the following causes..." for example we know that low English fluency causes an all-round bad experience for askers and respondents. But how best to guide new users through that?
 
Sure. Let's say you have an objective answer to that. How would you respond differently?
vs. self-reporting surveys
 
@roganjosh Please, that (earlier comment linked) is just unwelcoming. I suggest a bunch of specific actionable ways it could be improved, you suggest none, then you criticize me? I'm just wondering if survey is taken seriously, given how noone seems to have put thought into improving the methodology.
 
3:11 PM
nah, don't take it as an attack or anything, really.
 
No, I think you get angry at the drop of a hat and start with these kinda comments, and complain an awful lot
I asked you an objective question; you got an objective answer to the survey, how do you respond differently?
 
@roganjosh I suggest a bunch of improvements for the survey, you suggest none, then you complain, but say that I'm complaining. How to engage with that?
 
I didn't complain
 
@roganjosh (wait... I was already typing you the response to that before you lobbed the last comment at me...)
@roganjosh Stop right there. "get angry at the drop of a hat and start with these kinda comments, and complain an awful lot" is a complaint, it's a personal attack. It's unmerited and it's a violation of the room rules. Do you agree to knock off doing that?
@roganjosh as I already stated above if someone claims to be a Python wizard, or SQL intermediate, or Java beginner, see how their actual measurable verifiable real-world behavior corresponds to those other things.. Example: draw a table or graph of say self-reported years of experience vs SO rep accrual in [python]/[sql]/[java] tag.
Seems very basic but very useful to me. Don't you think?
 
3:20 PM
 
^ and yes I'm aware rep is gameable. That's part of what we investigate.
 
@smci I got called from work, sorry. It's not a personal attack, it's an observation. You can take or leave it as you wish.
 
@ParitoshSingh I have thought this in the past also, and I'm sure it is at least partly true - I continue to get upvotes on answers I posted years ago, but I'm not sure that makes me any more "reputable"
 
@piRSquared awww... that's even cuter than kitten pics (but don't tell poke I said that...). Is that an axolotl or whatever they're called?
 
3:36 PM
@roganjosh You have no idea what state of mind I'm in, but if you honestly ever think I post something only to complain, please do articulate how you think I should phrase it more constructively. Anyway I'm off for now, bye.
 
Reverse google image search suggests that it's a puffer fish, and that it has something to do with Fortnite. I do not wish to investigate further.
 
@smci You would be surprised. I recognise the over-defenciveness in you and it's something I face too.
This has just been a discussion, there are no repercussions.
 
You could probably make 'rep' a bit more meaningful if you controlled for tags and date of the post
 
I wonder if my program, which takes ninety mintues to execute, will finish in time for the meeting that it is a topic of, which is in two minutes.
Basic arithmetic suggests no, since I started it later than 88 minutes ago, but as long as I don't look at the console window, it's in a superposition of done and not done.
 
@roganjosh In this case if you look at the transcript above, I had already answered the question you twice asked me, before you even posted it. "Show graph/table of X vs Y" was the tl;dr, maybe I need to keep my paragraphs shorter. Anyway that's how people generally compare 2+ variables. Then we could see if 'years of experience' was correlated with anything else in (say) Python, but not SQL. Am I clearer now?
 
3:46 PM
Hello, I have this project structure and all is well when running in pycharm https://i.imgur.com/qQyxWLO.jpg

But when I try calling the python as a process from nodejs I keep getting this:
File "./sample/mod_control.py", line 1, in <module>
from sample.mod_class import *
ModuleNotFoundError: No module named 'sample'
 
@JonClements porcupine fish.
I intentionally look up non-mammals because its too easy to be a mammal and cute.
 
@piRSquared What can I say - it's my curse :)
 
I have a curse as well. Universal law of gravitation says I'm more attractive than you.
 
@JasminParent I wonder if adding an empty __init__.py file to your sample directory would do anything.
 
@Kevin no I tried :/
im not sure what I should put in it thought if I was to add stuff
 
3:52 PM
@JasminParent It sounds like you don't have PYTHONPATH set in the environment where you execute the python code.
 
hmm let me try
 
The quick-n-dirty solution would be to just do from mod_class import *. Since mod_control and mod_class are in the same directory, I expect they should be able to see one another if you don't qualify their names.
I don't know if this is the "right" solution. I try to keep my project directories flat because packages confuse and frighten me.
 
I alrready do from sample.mod_class import *
 
Yes, and I am suggesting that you delete that and try from mod_class import instead
 
oh ok
 
3:57 PM
I vaguely recall that the "right" way to do it is to make sample into a package by adding an __init__.py, and then use pip to install it so the module name package is accessible everywhere inside your current environment.
 
<--- Not an expert... but: from module_name import name_in_module only works if module_name is an actual module in the path. So you have to make sure your path is set up and that it is a module. Since sample is a directory, the only way to make python to see it as a module is to give it an __init__.py file.
 
ok adding an empty init.py makes it a module?
 
@piRSquared Sounds right to me. I think we all agree that the __init__.py is necessary. The only question is how to put the resulting package in the path. I think Code-Apprentice was half-suggesting modifying PYTHONPATH to include the sample directory (or maybe the backtester4 directory?), and I think pip can do the path manipulations for you (although I don't know what the actual command is)
 
or removing sample at this point would work?
 
Well if you modified your PYTHONPATH to include ./ then any python you attempt to run will know to look in the current directory as well. You should be able to navigate to the directory that contains sample and run this pip install --no-deps -e .
 
4:09 PM
@piRSquared but are your eyes actually blackholes like mine? :p
 
@piRSquared thanks man ill try those
 
@JonClements maybe you are more dense than I had assumed d-:
@JasminParent also, just because it may work doesn't mean you have it figured out. from sample.mod_class import * insists that sample is a module, we fix that with __init__.py and that sample is in the path. One of several approaches is to use the pip install I mentioned. Let us know how it goes.
 
sure gimme 1 min
-e requires one arg
sorry if obv
 
the dot "pip install --no-deps -e ." <--- right there
 
ok it asks for a setup.py
λ pip install --no-deps -e .
Directory '.' is not installable. File 'setup.py' not found.
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
 
4:19 PM
hmmm... yam.. as I said. Not an expert.
 
ill add it
 
I have setup.py but it's always been fuzzy how it works
Maybe easier to change PYTHONPATH as mentioned before
 
I did
oh i added my setup.py and now:

pip install --no-deps -e .
Obtaining file:///W:/backtester4
Complete output from command python setup.py egg_info:
running egg_info
creating Backtester4.egg-info
writing Backtester4.egg-info\PKG-INFO
writing dependency_links to Backtester4.egg-info\dependency_links.txt
writing top-level names to Backtester4.egg-info\top_level.txt
writing manifest file 'Backtester4.egg-info\SOURCES.txt'
error: package directory 'pandas' does not exist
 
<a reminder that __init__.py is not always necessary>
 
well now you have more problems
 
4:23 PM
wait it worked
the command at least
 
@vaultah do you have a link describing that?
 
The whole thing workd now thanks @piRSquared and everyone!!
 
PEP 420, namespace packages
 
@vaultah Elon Musk's favorite PEP
 
I need help with Python3 importing...
This is my scenario

./helper_py/processor.py
./tests/test_processor.py

> pytest tests/testprocessor.py

def test_processor():
print(__name__)
> from helper_py import processor
E ModuleNotFoundError: No module named 'helper_py'

tests\test_processor.py:3: ModuleNotFoundError

I can't get it working... no matter what... import helper_py etc doesn't work ...
 
4:31 PM
 
But seriously, you couldn't have found a more guilt inducing puppy image.
 
can anyone help me?
 
probably
 
Not with that formatting
 
How can I format it here?
 
4:35 PM
it is the first link on the star board to the right of this page
 
@0x45 Funny, we were just discussing a problem very much like this. chat.stackoverflow.com/transcript/message/46143991#46143991 had problems getting their package to be visible. We suggested adding an __init__.py and adding the package to the module search path.
 
recbg. love the cuteness overload pics
 
I need help with Python3 importing...
This is my scenario
Files: `
./helper_py/processor.py
./tests/test_processor.py
`
Running at `.`
`> pytest tests/testprocessor.py`
results in
`
def test_processor():
  print(__name__)
  > from helper_py import processor
  E ModuleNotFoundError: No module named 'helper_py'

tests\test_processor.py:3: ModuleNotFoundError
`
 
@AndrasDeak That is an unbelievable read. I don't know how these sort of things get resolved, other than a war of dueling narratives on social media. Wonder if the PSF Board of Directors gets dragged in. njs seems to be implicating their reputation a bit too.
 
4:37 PM
ew
can't properly format it
 
@0x45 As the formatting guide indicates, backticks only work if your message is one line long.
 
@0x45 I just gave you links
 
I need help with Python3 importing...
This is my scenario
Files:
./helper_py/processor.py
./tests/test_processor.py

Running at `.`
`> pytest tests/testprocessor.py`
results in

def test_processor():
  print(__name__)
  > from helper_py import processor
  E ModuleNotFoundError: No module named 'helper_py'

tests\test_processor.py:3: ModuleNotFoundError
better now?
 
Looks great.
 
@Kevin I checked your link to the chat. But I also read in a post that init is bad practice in python3?
 
4:40 PM
Anyway, I already gave my input -- add a __init__.py and add the package to the path in any of the ways discussed in the linked conversation
 
or not necessarily needed?
 
@0x45 Oh, interesting. Do you have a link? I'm half-clueless about the topic of packaging, so I'm pretty keen to learn about idiomatic approaches.
 
hold on
 
__init__ is not a bad practice
 
@0x45 What post said that?
 
4:42 PM
That link probably talks about putting code in __init__
And even then it's disputable
 
61
Q: Relative imports - ModuleNotFoundError: No module named x

RyanThis is the first time I've really sat down and tried python 3, and seem to be failing miserably. I have the following two files: test.py config.py config.py has a few functions defined in it as well as a few variables. I've stripped it down to the following: However, I'm getting the follo...

check out Igonato's answer
 
> P.S.: if you're sticking with Python 3 there is no more need in __init__.py files.
Hmm, I wish he had elaborated more.
 
Thanks, downvoted. Just for that sentence
 
I want to stick to Python3
So, @Kevin you are suggesting me to put an empty __init__.py to ./tests/?
 
from PEP 420 "Regular packages will continue to have an __init__.py and will reside in a single directory."
 
4:45 PM
Because, before I read that comment with init.py is not needed, I had an empty init.py in helper_py
 
@0x45 did it work then?
 
Can someone give me some reading material or nice tutorial for python3 packaging...?
this is just a mess lol
No it didn't
@vaultah
 
So... how do I do it now @vaultah
Add an empty init
or just call in my pipeline "-m" ?
Is there any standard?
 
I suggest doing both.
 
4:51 PM
Is there a cleaner way to import?
As in a more generic one? like using sys.path or stuff?
 
sys.path.append(the_directory_containing_the_file_you_want_to_import) will let you import that file, but there is much controversy about whether this is good practice
 
@Kevin absolute or relative?
 
IIRC, absolute. In other words, you would be able to do import processor but not from helper_py import processor
 
okay
 
wait sec, timeout
is there an init file present at the root?
 

« first day (3125 days earlier)      last day (1824 days later) »