« first day (2484 days earlier)      last day (2688 days later) » 

01:27
hey!
 
4 hours later…
05:31
Morning cbg
06:30
cbg
06:49
there's been a trend to upvote "possible duplicate of ..." comments instead of actually voting to close...
wow, people sure flag everything... can't even beg for upvotes anymore
07:09
cockroachlabs.com this looks nice
cbg
07:28
Cabbage
@Rawing That could be a good thing: people who don't have enough rep to close-vote may be upvoting the comments. So once they do have enough rep they'll be willing to help close-vote dupes. But I wish more of those people would realise they can search for dupes & submit them via the flagging process. Or even just post them in a comment. OTOH, I guess it's not easy for newbies to find good dupe targets.
it's never easy to find good dupe targets :/
07:45
Hi Guys
Hope you all are fine :)
#!/usr/bin/env python

# Print necessary headers.
print("Content-Type: text/html")
print()

import pymysql.cursors
# Connect to the database.
import pymysql
conn = pymysql.connect(db='candidate', user='root',passwd='123',host='localhost')
print ("connect successful!!")
c = conn.cursor()
c.execute("SELECT can_id,can_name,state,total_votes FROM voting")
result_set = c.fetchall()
for row in result_set:
print(row["can_id"])
print(row) print all records but when print(row["can_id"]) nothing
did you check my issue
@WaqasAhmed We normally put all import statements at the start of the script. Don't bury them in random places throughout the script. Also, HTTP header lines should use the CRLF end of line convention. If you're on Windows that will happen automatically, but it's better to be explicit and tell print to end lines with '\r\n'.
@WaqasAhmed what does print(row) print?
it doesn't print a dictionary does it?
@WaqasAhmed We can't analyse your code correctly because it's not indented properly. And you didn't tell us how you're running this code. Are you just running it in the terminal, or are you running it on a server? And if so, which server are you running this code with? Is it configured to do CGI? Does it know to allow Python scripts to do CGI stuff?
07:59
Umm, did I miss the problem description? What's wrong with that code?
oh, there's something in the last line...
@WaqasAhmed Is result_set a list of dictionaries? BTW, you should be telling us all of this stuff up-front, not forcing us to interrogate you to extract this important info from you. ;) Please see chat.stackoverflow.com/transcript/message/38315935#38315935
Cabbage
Serge Ballesta is strangely silent in response to my comment. ;) stackoverflow.com/questions/45500353/…
Hi, @poke The latest xkcd is about bunnies, but I don't get it. xkcd.com/1871
@PM2Ring In doubt: explainxkcd.com/1871
But I really need access to this alert system.
Thanks for posting that link
08:12
ok Thanks
Sure thing
I should probably eventually expand this into a self-answered question about “how to parse and evaluate Python expressions”
@poke I figured out most of that already. But it's still not that funny. ;)
Yeah, it’s not really
Maybe I'm a bit prejudiced because rabbits in Australia are foreign vermin that have caused lots of destruction. I do admit they can be cute, though.
It’s a bit too self-referencing without other content
08:15
I was aware of the previous bun comic, and I know beret guy is a bit obsessed with baked goods.
08:26
I didn’t remember either tbh
I get stats for a column using df.score.describe() it gives me total count and percentiles for that column. Is there a way to have count for each percentile (example if total count is 100, and 90th%tile is 90, we know that 10 entries had 90 score)
08:59
@Rawing <3k rep close flags push a question into the CVQ and upvote those comments (like close votes do)
and cbg
unclear I take it
yeah
very
and lazy
btw there's also a cv-pls script from the SOCVR guys
I believe it adds a button for questions that posts the request in your room of preference
I think I’m quicker with the keyboard
no, I think it's coupled to close votes
I think you can choose during voting whether to post a cv-pls
I've never used it and it's been a while so the details are hazy
ah yes, nice answers are coming in
41k, 63k.........
it's also nice how the question doesn't contain any own code; at least they tried to search
meh, I'll close it before I lose all my rep
09:28
@AndrasDeak It would be nice if they included code, but they have done some research & linked code that doesn't do what they want. I guess they could've posted some code & shown that it gave wrong output. ;)
How weird. Another new question that needs partial list flattening: stackoverflow.com/questions/45503195/…
Why can't people paste code, but try and produce ascii art etc.
For example a lot of people in create more or less beatiful ascii tables of their models, when the actual class definitions would be a lot more informative.
09:51
Maybe they think their pretty ASCII table will make the question look good, but they're too embarrassed to show their crummy code. ;)
10:03
or they have no code, only an idea of how it should look like
annoying avatars strongly correlate with crappy questions
That's why I don't ask
10:18
I don't know sqlalchemy, but I get the feeling that there a lot of newbies who don't have basic Python skills that are trying to use it. But I guess that's a problem with many Python frameworks, like Numpy, Pandas, Tensorflow, OpenCv, and of course the various Web frameworks.
@PM2Ring I think you're right on the money.
at least with numpy you can easily cargo-cult a piece of code that works albeit very badly
after all if you replace your lists with arrays, vanilla python still works
but then you can ask "why is my code not faster"
I guess an ORM makes it seemingly possible to cargo-cult, but it falls apart pretty quickly.
Hello Team,

I am planning to build a simple intranet application that will restrict the users to access specific url to specific users. So how I can do this
10:33
welcome
Jul 25 at 19:56, by davidism
Do research before you ask. Have a basic understanding before you ask. Don't answer if these two things are obviously not fulfilled.
your question sounds quite broad
Okay thanks
 
1 hour later…
11:57
morning cbg
12:07
morning cabbage all, @PaulMcG
12:34
I've been thinking about ethics lately and "Do unto others as you would have them do unto you" loses some of its prescriptive power when you have different values/priorities/preferences from your immediate peer group. I would have everybody talk about Magic: The Gathering with me all day, and yet the strangers on the bus seem pretty off-put when I ask them their opinions on the relative utility of upstart Inquisition of Kozilek vs classic Thoughtseize.
those adages are calibrated to normies
"Do unto others as you would have them do unto you if you had their values/priorities/preferences instead of your own" is a big mouthful and decomposes to "do what other people want" but then the first time someone asks me for change, I'd have to give them my life savings.
Unless that person has an ethical system where they would prefer that other people not lower themselves into poverty even if it enriches the first person. But I question the value of an ethical system that has to recursively analyze the ethical systems of the people I interact with. There will be a stack overflow the first time I meet someone that also has a recursive ethical system.
Possibly I could adopt a hybrid system where I recursively analyze only the ethical systems that are not themselves recursive, but I think that might run up against the Halting Problem.
I know you're probably not serious, but anyway I believe the spirit of the adage is that "When about to take intentionally harmful/malicious actions against others, think first how you'd feel if the tables would turn"
rooting in a naive game-theoretical perspective of "if we all realize that being assholes to each other doesn't actually benefit any of us", which would be fine if it weren't for millions of years of evolution teaching us that "not me = bad, must kill"
Next up: Alice and Bob live next to a lake. Alice goes outside and sees a drowning child, but does not help. Bob stays inside all day and watches anime with his sound-canceling shades drawn closed. Are Alice and Bob equally immoral? Does the answer change if Bob knows ahead of time that a hundred children drown in the lake each year?
can Alice swim?
12:46
Hey guys! I'm using Keras for training. I have a question
Yes, but her expensive watch will be ruined.
Can she take it off? Drowning is a slow process.
@Kevin that's why she should have given it to the first beggar that asked for change
I have only one output which is a distribution centered around zero. My raw distribution is perfectly symmetric around zero but the training result is biased. Do you have any idea why this happened?
I use DNN and Keras in python
I don't know any of the tools or methods, but generally speaking: is the model/network/whatever you're fitting itself symmetric?
if symmetry is not hard-wired into it, there's no guarantee that the result will be symmetric
12:50
Alice has a wide distribution of expensive accessories that are all ruined on contact with water. Given information regarding the price of each accessory, the amount of time it takes to remove, the function P(t) that gives the probability that the child will drown after t seconds of removing accessories, and the monetary value of a human life as defined by OSHA standards, determine how many and which accessories Alice should remove, if any
When I commit to my python repo
@AndrasDeak no, my inputs distribution are not symmetric
is there any "general" idea for removing this bias?
well you can always symmetrize anything, but depending on your data that might introduce nasty artifacts
you have to make sure that it makes sense to discard asymmetry
@AndrasDeak using a symmetric change of variable? is that what you mean?
12:53
I would expect the idiomatic way to be fitting a model that is symmetric
that will still use your real data, but give you a symmetric fit
@AndrasDeak in my case, it doesn't make sense
@Kiarash well if you have a distribution around 0 that you want to symmetrize, you can take (f(x)+f(-x))/2 instead. That will be symmetric by force.
@Kiarash so perhaps your model shouldn't be symmetric either? :P
anyway, I have to go, and I'm not of much practical help anyway
good luck
hello
can I ask a question?
Welcome, please read the room rules
I will permit it just this once.
12:56
    >>> function snek() {
      File "<stdin>", line 1
        function snek() {
                    ^
    SyntaxError: invalid syntax
It's not working
you need to from __future__ import braces
Try deleting the ">>>", as Python does not have a right-shift-one-and-a-half-times unary operator
also check the previous line, you might be missing a closing parenthesis
You may be thinking of the "much much greater than" operator, but that takes two arguments
wait, is this python 4?
12:58
4.2.1
Thank you Kevin. I needed one more >
it works kthxbai
I was going to say that normally you'd have to wait for Python 4 to be invented before its interpreter will start working, but since your problem is solved I assume your architecture must have a TPU (Tachyon Processing Unit) which eliminates such inconveniences as "causality"
13:18
cbg folks
wow...that idjaw is something
Actual programming chat. I have two classes, Stage and Entity. A stage has many entities, and every entity belongs to one stage. Should I give each Entity a stage attribute, even if I'm not going to use the attribute for anything? I'm viewing this as a conflict between my ideals of clear representation of relationships, Vs simple practicality
Generally, I would not have a back pointer from Entity to Stage.
sorry..it's early for me and I'm having a hard time visualizing this. Do you think you can pastebin something?
\o cbg
Doing so makes it harder to test Entity in isolation
Circular refs are also unfriendly to gc, or at least they used to be
13:23
grumble
You should then explain these things in your question. The readers have zero knowledge of your own research and what you already know other than what you write in your question! Please make sure you put together a more detailed/coherent question so people actually know where you are coming from based on your current knowledge. The current state of your question provides zero indication of this. — idjaw 7 secs ago
ok so I would say definitely not b. That seems very unintuitive
between the two definitely the first one. However, what is the responsibility of these classes
because maybe one class can collect instances rather than create a new instance each time and collect a single instance of the other class?
IIRC circular references are eventually collected by the gc when it periodically crawls the reference chain of all objects that are still bound to names. This process is considerably slower than zapping objects when their refcount hits zero, and can occur several byte-codes after the circularly-reffing objects become inaccessible.
class Stage:
    def __init__(self):
        self.entities = []

    def add_entity(e):
        self.entities.append(e)
        e.stage = self
Not that they can't be gc'ed, it is just more work to do so
You could also assign the back pointer as a weak reference
But AFAIK the gc does the reference crawl regardless of whether a circular ref is likely to exist or not so I don't think it makes all that much difference runtime-wise
For the same reason that garbage men still have to drive down every block even if nobody had anything to dispose of that week
13:29
I would use stage as a collector for the other class
@PaulMcG Similar to this, I had an idea of a factory method of sorts:
class Stage:
    def __init__(self):
        self.entities = []
    def add_entity(self, *args, **kargs):
        self.entities.append(Entity(self, *args, **kargs))
sigh
this question was somehow re-opened
Which is nice because it satisfies the condition of "all Entity objects always have a non-None stage attribute" which might theoretically be useful
Not keen on that - what if you want to add an Entity subclass to a Stage?
13:31
2 vs 2 somehow got it reopened stackoverflow.com/review/reopen/16926293
Hmm,
def add_entity(self, cls, *args, **kargs):
    self.entities.append(cls(self, *args, **kargs))
What is that about? Am I missing something? Probably manual reopen votes
Then I can do stage_a.add_entity(EntitySubclass, "foo", "bar", 23)
df.groupby(['Name','Fruit']).price.cumsum() any idea if I want to use mod cumsum (just take positive values)
anyway, rhubarb again
13:32
suppose price can be in -ve (i want to ignore it)
Perhaps I should just let go of the principle of "after __init__ runs, an object should be 100% ready for use", in which case I am free to create an Entity and only later assign its stage attribute to something meaningful
Feels clumbersome - so Entity can't exist outside of a Stage?
@Rawing OP wants you to post in a dup-able question. don't know if OP wants to give you repz, or wants you to provide the exact answer for OP to copy.
An Entity can exist in a vacuum, but it is not able to do useful work.
If you find yourself doing lots of "if self.stage is not None:" inside Entity, then revisit this.
But your initial posit was that the stage attribute was just there for mental modeling, and wouldn't really be used
13:35
@MooingRawr I think he just wants to do "the right thing" and reward me for solving his problem even though I've told him it's fine to leave it closed and it wasn't really me who identified the problem in the first place
@Rawing - SO needs a tip jar for people to just put repz into
Sorry that all of this is so abstract. I do have a concrete problem underneath, but at the moment I'm just probing the possibility space of when backreferences are appropriate and how they should be designed
Much of my thinking on this goes back to the GoF Design Patterns book - it still holds up in some places, not everywhere tho.
Finding general rules of thumb that I can apply in the future, is far more valuable than actually getting my project working ;-)
Revisit that book then, looking at the Structural patterns
13:39
morning cabbage
I'm not sure if I should even VTC that question again...
Up until a month ago I had the book sitting in my desk drawer, but then I took it home for some reason... Bad timing.
@PaulMcG aka bounties!
My only issue with the book is that some of it is influenced by the rigidity of Java and C++, so it imposes pattern structures that aren't always relevant with Python.
13:42
but bounties cost the giver Repz, I think Paul might have been talking about giving repz without losing any (similar to upvotes, and answers) in a tip form. but I agree that since we have bounties there wouldn't be a need for tips.
Didn't Alex Martelli do a Design Patterns in Python book or series?
I never figured out how bounties work
bounties = u give your repz to someone else's answer / question
@MooingRawr IRL tips aren't free. They come out of my wallet.
My hard-earned repz?
@Code-Apprentice a tip of my hat is "free" :D
13:43
From basic Python answers I posted 7 years ago?
Oh btw hows the new job Code ?
It's like a pension
@MooingRawr pretty good. Did some python yesterday with selenium.
I don't have any good enough answers to generate revenue
still need to configure pycharm to find all the source code for the project.
13:44
if you want to give someone rep, you can always go to their profile and upvote r̶a̶n̶d̶o̶m̶ good answers
@Code-Apprentice oh fun times... I should look for a new job like yours
or maybe I need to configure how the project runs better...the folder structure is kind of odd
@Rawing and if you want to spite someone you randomly downvote them but beware as the karma gods will be out to get you :P
anyone have experience with unittest and pytest in pycharm?
me me
what's happening?
13:47
What is a common way to structure the directories?
So like I have a tests folder in my project. How do I run it? At the moment, I am putting tests in PYTHONPATH and running pycharm tests/mytests.py.
Ah. yes. OK. hold up.
So, mainly there are two ways I go about this there is one way where you have:
I mean pytest tests/mytests.py
from the CLI
app/<real_code>
tests/<test_code>

or

app/<real_code>
app/tests/<test_code>
and then in PyCharm when I configure my test runner, what I do is assign my working directory w.r.t how I am going to really run the app: e.g. inside app so that all my imports match uniformly
that is the key part. the working directory
because the main problem you end up facing when running your tests is "cannot import blah"
because the working directory ends up being different than what should be expected when doing your real code
I always make sure things are the same throughout the project to avoid this headache and make the project transferable to different systems, e.g. CI
Sounds reasonable
@Code-Apprentice here
that's one example. Feel free to browse any other project under that org name too
let me know if you have any other questions about that.
sorry. that is the real one. The previous one was the actual app runner.
14:05
This is a selenium project which tests an "external" app (external to the test project).
The project being tested is in another language, not python.
Even though I don't have to worry about importing the app itself, there are similar issues with some of the supporting source code for testing.
The directory structure is
@idjaw which one do you prefer? I feel like the latter one seems better....
/tests
    # All the selenium tests
functions.py
config.py
# other supporting .py files
I am running from the command-line in the same way as the original developer. But I'd like to do everything from inside PyCharm. Right now, PyCharm gives me a lot of "unresolved reference" errors (or similar).
Those are all for functions in the files in the root directory of the project.
So, yeah. @Code-Apprentice to me that is an indication that you are not unifying you working directory so all your imports are from the same point of execution
14:09
@MooingRawr I like the second version. It keeps the "app" which is deliverable for production separate from the "test" that probably shouldn't go into production.
I suggest you make sure your imports are based on that
Yes. When deploying an app in to production you usually don't provide the tests folder
so that separation would be good
To clarify, I am talking about red-squigglies in the IDE itself, not errors when I run the tests.
I get run-time errors when running in PyCharm, too....but that wasn't what I was referring to in the previous message.
hmm....are you using the right venv?
@idjaw IMO, having the tests under app/tests makes it more difficult.
@Code-Apprentice don't you mean u like the first one then ?
14:11
@idjaw I believe so. Not at work right now.
@MooingRawr oops...yes, that is what I meant
@Code-Apprentice yes. I like app and tests being separate from each other. I think I might have accidentally indicated I liked tests inside app. I don't
So there are two issues, probably related: getting the IDE to recognize all the side files for error reporting and auto completion. And setting up the Run Configuration.
@idjaw thanks for all the suggestions. I will play with this first thing in the morning.
np! :)
how do you guys handle your certificate updates on systems? Do you wait for expiration and then go ahead and push through a new certificate? Or do you have a service that facilitates the detection and pushes the new certs?
I want to push for the latter solution because....automation is king.
wim
wim
please do NOT put tests anywhere under the app subdirectory
if you must, then be sure to exclude it in setup.py with adding the kwarg: packages=find_packages(exclude=['tests']),
yeah, we all agreed the separation is the better option
wim
wim
14:25
and be careful; if you use exclude='tests' you actually exclude the subdirectories 't' , 'e', 's' and still distribute 'tests'
Because exclude is expected list/sequence/iterable?
What is the correct generic term?
wim
wim
sequence
On the bus on my way to work and I forgot my earbuds
Can PyCharm not automatically format code as I type? Haven't been able to find anything useful on google...
what do you mean?
14:37
Reminds me of how in Visual Studio when I type frobnicate(, it automatically adds a ")" after my cursor. Not terribly fond of that.
frobnicate?
sublime text does this, Kevin. Also I am fond of the { being finished though with a }
Like automatically reformat my code to PEP8 style. For example if I type a= 5 it should just change it to a = 5 instead of pestering me about the darn space
Double plus unfond of when I'm trying to put a variable name in a spot that the parser has decided can only contain types. I type "x" followed by a space, and it helpfully expands that to XmlReaderBeanFactory
Oh yeah, that one I do get a lot :P
14:39
^ Oh I hate that soooo much. Makes using lamba in c# so annoying.
That was exactly the circumstance where it last happened to me :-)
I ended up typing eh => instead
lol
I think that might be it. But I'm not sure if it does it automatically or just warns you. Worth a shot. It does mention automation.
You can tell my code from my co worker's code based on my uses of eh.... I have a bad habit of constructing my return successful flags as : successfulEh. so if(!successfulEh){ do something}
14:41
Most of the time it's my fault and there really can't be a variable name in the spot I'm typing, but sometimes my natural workflow leads me to write parts of an expression out of order, the intermediate steps of which aren't strictly syntactically correct
but in lambda what are you suppose to use in replacement of x? is there like a standard variable name like tempItemsFromIterator?
@MooingRawr Depends on what the argument is supposed to be?
Or imagine a lambda with two arguments!
I find that when writing lambdas, x, y or any non meaningful variable names, it makes it clear to the reader it's a temp variable.
Why does it matter if it’s “temp”? Isn’t any variable a temp variable?
:D maybe? What happens when you turn off your computer and the electrons finally stop flowing in certain spaces. what happens to our x friend ?
14:43
Yes, except in the fictional programming language ~ath ("tildeath"), which has variables that survive until the death of the universe
5
You should treat lambda function variables the same way you treat the loop variable in a foreach loop.
is that what human death is ? just a temporally suspension of activities until our universe is turned on again?
(Yes, that's a real fictional language that I didn't make up just now)
@Kevin KevinScript 2?
It would explain why we don't remember our past life, since we don't have recoverable state of memories :D
14:45
@idjaw Sadly, that doesn't seem to be fully automatic. It's making me press Alt+Enter to reformat.
I guess I'll just live with the yellow squiggles.
To de-derail this conversation, I'm perfectly happy using lambda x:
And now you derailed it into silence. Great Kevin.
@MooingRawr Ctrl-Alt-L is the default shortcut
de-derail or rerail?
@Code-Apprentice for what o.o ? sorry I don't understand your reply to that comment
@MooingRawr No idea, I only boarded the train when it was already about the x variables.
@Code-Apprentice There’s no default CTRL+ALT+L shortcut in Sublime Text.
14:52
rb folks
@AndyK \o rbrb
Found the specification: ~ATH
Either look into proper HTML parsing, or look into regex for parsing the part you need. (in b4 parsing html with regex raises cthulhu from his sleep etc) — Timothy Groote 44 secs ago
o god
People need to understand the difference between parsing and extracting information...
Unpopular opinion time: 90% of the people that need to pull something out of HTML would be perfectly served by writing a regex. They don't need an arbitrary HTML parser, because they're not trying to parse arbitrary HTML. They're trying to parse a small subset of HTML like "the first text element following <div><span><table><tr><td> with that exact order, spacing, and capitalization"
14:59
^ this
The pages most likely to be scraped are ones that are computer generated, so you don't have to worry about the writer getting creative and deciding to switch all his divs with DIVs. You're allowed to be brittle when things aren't going to break.
@MooingRawr misclick...supposed to be reply to the message following yours
Change of topic, but does pathlib not have a better way to recursively list the contents of a directory than directory.rglob('*')? Why isn't directory.iterdir(recursive=True) a thing?
@Kevin - Pyparsing includes some HTML helpers to make these kinds of extractors more manageable, and handle variations like tags in upper/lower case, tag namespaces, attributes in varying order, quoted strings that aren't always quoted, etc. (makeHTMLTags, withAttribute and withClass).
15:06
Doggo was panting outside in the heat, stopped for a bit, a bit of her tongue was stuck out. Heat level officially "derp"
@poke I was referring to MooingRawr's question about PyCharm.
That’s not what you were replying to though :P
18 mins ago, by Code-Apprentice
@MooingRawr Ctrl-Alt-L is the default shortcut
@poke In my head I was =p
1 min ago, by Code-Apprentice
@MooingRawr misclick...supposed to be reply to the message following yours
your head doesn’t count.
1...2...3...4...5...
all in my head!
15:08
@PaulMcG Robust parsers definitely have value for those reasons. I just want people to spend ten seconds thinking about which tool is appropriate for the job before them.
Rather than a reflexive "regex will eat your soul, better load up BeautifulSoup" response every time
The thing is, it's not a full-on HTML parser like BS, it doesn't build a full document model, and consequently doesn't choke if there is some deviant part in an unrelated corner of the page
@Code-Apprentice I know about that, but there's no point if it's a 3-button key combination. I'd be better off just typing the darned space manually. It's fully automatic or bust, I'm afraid.
@Rawing Also, when your cursor is on a line that gives a PEP8 inspection error, you can press Alt-Enter to get a menu of options about how to handle it.
What particular PEP8 spec are you referring to, btw?
Whatever it is that PyCharm enforces, basically :p
stackoverflow.com/q/45510119 typo? They have a stray app.run() in the middle of some code.
15:12
Though all the yellow squiggles are very fitting in a python source file.
'cause they look like snakes.
ooooh it's a snake
wow so much fanart if you google search images for "badger badger snake"
that’s literally what I searched
I suggested that an OP try XYZ, then I looked at their history and saw a question from an hour ago where another commenter suggested XYZ, which the OP rejected for unclear reasons. File another one under "why did I bother"
15:27
dangit. I have an earworm now.
*earsnake
But I guess it would make me a poor pearl diver if I refused to pick up an oyster unless I already knew what was inside.
I'm looking at questions on main...I'll never get to 20k :D
Why do I not know this!?
15:29
@Rawing I was wondering if you had a particular example in mind.
Bah, Linux binds Alt-Ctrl-L to "lock screen"
which overrides app-specific bindings
@poke wat
@Code-Apprentice fortunately in linux most things can be reconfigured
@AndrasDeak yup, and since I'm on a VM atm, I can just disable it's lock screen shortcut
@Code-Apprentice Well, my primary annoyances are whitespace around operators and indentation of multi-line expressions. And if it could automatically wrap long lines, that'd also be bueno.
at least that seems to be the best solution right now
@Rawing Ctrl-Alt-L and Alt-Enter should take care of all of those. I don't know about any way to configure it to format those automagically as you type.
wim
wim
best
user image
4
15:38
that's why we need to save them
Got another PyCharm question...I cloned a repo using the CLI. The remote is on BitBucket and I'm using the SSH URL. When I try to push a branch in PyCharm, I get a "failed to push" error. How do I configure it to see my private key?
@wim When I was searching for “badger snake” (in contrast to “badger badger snake”), I actually found a lot of pictures of badgers eating snakes, so I’m not sure if that is a realistic representation of the relationship between badgers and snakes.
those plushie badgers are just too cute
wim
wim
@Code-Apprentice it's bitbucket you need to configure to know your key ..
15:42
@wim wow, that is a very good one!
@wim That end is pretty dark
@wim I put my public key on bitbucket already. I can do everything from the CLI that I wish
Hey all, im busy just trying to throw together a simple program that maps out a network and draws a network graph from that. Currently i am using networkx and matplotlib to draw out the graphs i create. I want to have something a bit more "pretty" and useful for example clicking on hosts etc and was wondering if anyone had some suggestions of gui modules that would be useful for this kind of thing. Im trying gtk3 but I dont know if there is perhaps a far simpler easier module out there.
@idjaw You around?
Sorry for the long post
15:47
in principle you can interact with matplotlib plots...but I admit it might not be the most convenient (I don't have practical experience)
Okay, back to the testing configuration question earlier...I have the following setup:
tests
    foo.py
bar.py
see e.g. docs and example
And foo.py has from bar import *. In PyCharm, this line gives a "unresolved reference" error at bar.
How do I get PyCharm to see bar.py in the projects root directory?
How are the scripts executed?
because unless foo.py is being executed in the context of a Python package, it will not see import bar as an absolute import on the package level
I'm not even executing them right now. I'm just trying to get rid of the red squigglies in the IDE
15:51
Oh, then I’m out. No idea about PyCharm
hmm...maybe I should just move all the code into tests.
or even a subfolder
To answer your question more directly, I've been running from the command line. I am also trying to run it from PyCharm instead.
I think if you correctly configure your tests PyCharm will automagically allow them to import project-level files
@AndrasDeak that seems useful for navigating a graph however it isnt that good for drawing and navigating network diagrams ill just carry on trying to write a gtk3 gui cause it is probably a very specific use case
Confirmed, PyCharm definitely pulls some shenanigans if you execute a script as a test.

« first day (2484 days earlier)      last day (2688 days later) »