« first day (1784 days earlier)      last day (3167 days later) » 

8:01 PM
This answer is a bit wrong at the end. But I am damn lazy to even comment atm.
 
hey guys. I'm struggling with relative python imports.

My structure is:
client
...client.py
server
...server.py
common
...__init__.py
...stuff.py

I want to import my_class from stuff.py into either client.py or server.py, and I'm using:

from ..common.stuff import my_class

But I get this error: ValueError: Attempted relative import in non-package
 
user559633
Using Python 2.1 I presume?
 
2.7
 
user559633
Fancy
 
relative import error => search Ignacio's top answers
Aha here it is. @Oliver Did you check this out?
 
8:05 PM
I couldn't understand the answer in SO. Either run it as python -m or something about packages that I didn't understand
I'm using PyCharm, so not sure how to change the way the script is run.
 
There is a nicely elaborated recent answer below with a link to the docs as suggested by the upvoted comment. — J Richard Snape Jul 28 at 10:59
 
The sys path hacking option is horrible.
 
@Oliver Hehe. Even I had the same thoughts when I first did it.
 
Either I hack sys path with every import, or always run the script as python -m client, which again seems ridiculous
 
Late night here. Gotta go.
rbrb all
 
8:09 PM
o/
 
user559633
@Oliver Welcome to python 2.
 
user559633
Go to python 3
 
user559633
either way, not liking the options you have doesn't finish the work for you
 
so unpythonic =/
 
user559633
then use python 3
 
8:10 PM
is there a better relative import solution in 3?
I've not really used 3 yet
 
user559633
no, i just like typing the phrase "python 3"
 
user559633
(Yes, relative imports are more new-user friendly in Python 3)
 
yea sarcasm is hard to grasp over chat
 
user559633
it's not though
 
DSM
If you assume tristan is always being sarcastic, you'll be right 80% of the time, which is good enough for government work.
 
user559633
8:12 PM
my suggesting python 3 multiple times is probably a clear suggestion that python 3 has a different import behavior
 
different and better are rarely the same
 
user559633
what's the deal with airline food
 
user559633
here, because this is getting tedious docs.python.org/3/reference/import.html
 
DSM
I wish I knew how to type out the Seinfeld scene-change notes.
 
user559633
for python 2, change your import path or use -m or structure things appropriately for the system of rules your code is meant to run under
 
user559633
8:16 PM
i have been there before. One love.
 
yes yes, I'll just flatten the folder structure. Go back to a flat heap of files. Many thanks for your python wisdom, infinite patience and staggering humility to offer help.
 
cbg Steve
 
user559633
@Oliver Sarcasm is hard to grasp over chat.
 
cbg Jon, and all, bugrit
 
user559633
You're welcome, I was afraid that you were going to get your panties twisted over not receiving the answer you wanted to hear along with a lemon slice in your water.
 
DSM
8:17 PM
Cabbage for Mr. Holden, who I've just realized has glasses very similar to mine.
 
adds notes to journal
 
@DSM glasses? Haven't worn them for three years, so you're on your own
 
user559633
This will greatly improve my DSM costume I've been working on for Halloween
 
DSM
@holdenweb: then your picture is due an update. :-)
 
Went to the opticians about four years ago, and she explained that the lengthening of my eyesight (due to the decrepitude natural in old age) meant that my left eye, at distances over about 15 feet, now had 20/20 vision and my right eye was so myopic it had a natural focal length of about 3 feet
 
user559633
8:19 PM
O_o
 
DSM
Wow, that symbol is oddly appropriate in this context.
 
So she prescribed a contact lens for my right eye only, which meant my distance vision was perfect but I had to wear reading glasses. So now I wear nothing, and let the eyes sort out which one dominates for the task at hand. Seems to work.
@DSM indeed
 
My eyesight is just awful. Think I'm about - 10 in both eyes.
 
user559633
updates RO_weaknesses.xls
 
I'm also allergic to fire and weak willed men.
 
user559633
8:27 PM
i'm allergic to any liquid under 80 proof
 
user559633
although i sometimes confuse "allergic" with "simply don't like"
 
DSM
Okay, got into the office early today (stupid morning meeting with #CFH), which means I get to leave at a respectable hour. Enjoy the weekend, all.
 
Alcohol proof always confused me. Why not just use normal percentage?
 
user559633
Take care DSM!
 
user559633
@Ffisegydd You're the doctor
 
8:29 PM
I believe you actual mean Doctor Consultant.
 
@Ffisegydd amount of liquid required to prevent gunpowder from exploding iirc
Easier to measure on an old navy ship that ABV
 
Oh it's for historic reasons when they measured relative to a liquid that was about 50% abv
 
One of snapey's useless and trivial facts
 
user559633
I'd watch that show
 
correctness in (True, False)
 
8:31 PM
And yeah the liquid was from the 16th century navy
 
user559633
That's right according to the compendium of bullshit, hearsay, and propaganda that is wikipedia
 
OK - so half right. Or 95 degrees proof as I prefer to call it.
P.S. I have not been drinking tonight - making this a poor excuse for a Friday
 
user559633
a.k.a. wikie-p a.k.a the charlatan and dilettante den
 
user559633
concerns aside for what that sentence implies, the night is still young
 
Drunken JRS is the best JRS.
 
user559633
8:35 PM
J Richard Squared
 
user559633
I'm looking forward to the stackoverflow logo returning to normal
 
user559633
 
user559633
looks pixelated and dirty like a japanese adult video
 
Phrasing.
 
user559633
sorry, fixed that
 
8:39 PM
:D
 
@Ffisegydd I agree with this, but my Mrs, unfortunately, differs.
 
What does she know!? (Lots.)
 
Too much, that's the problem :)
 
user559633
@JRichardSnape Just scream "IT'S A BOY'S NIGHT OUT, BARBARA" from your computer chair while drinking
 
I used to kick my missus out when I was drinking and raiding.
Not as bad as it sounds, she did have her own flat to go to.
 
user559633
8:49 PM
@Ffisegydd Seems wasteful and offensive to the other players.
 
My phone battery is about to run out so I'll have to say "Screw you all, you're all terrible human beings, and by all I mean just tristan."
 
user559633
@Ffisegydd Love you too, buddy
 
Ha - says a welshman who soon won't be able to see what we say about him... ;)
goodnight fizzy
 
user559633
happy labor day weekend to everyone whether you live in america or somewhere inferior
 
Yes!!!! Finally got my multi page tables looking right in LaTeX. My joy is unbounded
 
user559633
9:11 PM
Ready for the first-est of first world problems? I want to go shoot pool at a dive bar, but the dive bars around here aren't the type I prefer
 
FIRST WORLD PROBLEM!! FIRST WORLD PROBLEM!!!
 
user559633
i want brooklyn dive, not small town new england dive :/
 
10:51 PM
Hello, everyone. Does anyone use dominate tags library? I had a question about how to use html rowspan.
 
@AjGauravdeep, don't ask to ask a question, just ask.
http://sopython.com/chatroom
 
Okay. So do you know the answer?
 
No. I don't. But you also haven't asked the question. Just ask the question and if someone knows, they'll respond.

Please read the chat rules.
 
My question was asked above in case you didn't notice. Oh wait, you were more focused in finding out mistakes.
Does anyone use dominate tags library? I had a question about how to use html rowspan.
 
@AjGauravdeep, what is the question?
 
10:55 PM
I'm sure then, the answer is "yes". Someone does.
 
I am create a table with 4 columns. First and second column has 1 row. 3rd and 4th column has 5 rows. I am not able to get this multiple row for 3rd and 4th column working. I tried to look for it's notes and tried to go through their github code, but my apologies of bad researching i believe, i couldn't find it.
 
"... second column has 1 row. 2nd ... column has 5 rows." What do you mean? EDIT: Ah, okay.
 
edited. Sorry. 3rd and 4th column has 5 rows.
i have peace of code. if you want to see, which might help. May i?
 
@AjGauravdeep, why don't you post a SO question?
 
I will very soon, if none of you can help. I have heard good things about this website and people mentioned, try to ask question on chat first and then post if this does't work.
 
11:02 PM
Eh we'll try to help if possible (people are friendly here), but the SO site is better for full questions, plus more people visit it.
 
Thanks.
 
Of course. Good luck.
 
a table by definition has only a single number of rows that apply to the whole table ...
 
You could always post it there, then post the link here.
 
you cant have different numbers of rows for different columns
you could however have empty strings in the columns you dont want on a given row ...
 
11:05 PM
@Cyphase, davidism generally tells people not to link new questions on the forums to the chat room.
 
@Cyphase im pretty sure you need to wait at least 24 hours after posting a question to link it here
(well if you dont want someone to delete your link and kick you)
 
I think you're looking to apply the rowspan attribute to a td tag, which looks like it's a possibility. The doc on that libraries front page implies you can set attributes on a tag element
 
why are you using that library ... jinja is great for this kind of thing
 
@AlexanderHuszagh, @JoranBeasley, whoops, my mistake :).
 
11:07 PM
but I have to leave now - others probs have experience, I have only google :p
rbrb
 
Thanks Joran. I am just working on someone's code. I cannot go around changing his whole code for a small fix. And yes Snape, thats the idea.
 
I have read the rules, just wasn't thinking :P.
 
actually that library looks pretty nice
 
:p No worries.

Also, Aj, I had no knowledge of it but just followed it. Looks like a good library.
One thing I will add @AjGauravdeep (I'll get to the rest later, debugging something right now), is that variables are quite useful...

I count the same string 10x in your code snippet, which instead of doing 10x, you could just define a variable:

text_style = "font-size:small;text-align:center;padding:4px"
 
Agreed. again, someone else's code. I don't plan to change anything i don't write or not effecting my work much.
 
11:22 PM
Hello everyone
 
Few issues though, and cbg @JonathanMusso
 
It means "Hi", read here:

http://sopython.com/chatroom
 
Aha! Melon, sprouts, potato! lol
 
td("",colspan="2",rowspan="3") would I think create a 2 wide by 3 tall td element ... not entirely sure thats what you want though
at least assuming I am reading the docs right
 
11:28 PM
can you send me the links to docs you are looking at?
 
calling it docs might be a bit of a stretch ...
specifically in the __init__
for attr, value in kwargs.items():
      self.set_attribute(*dom_tag.clean_pair(attr, value))
and then of coarse armed with this knowledge w3schools.com/tags/tag_td.asp
 
11:41 PM
Alaxander, i have made the change you requested. Actually i was right, i would rather not post questions here. I get a -1 only coz i used variables. and didn't import dominate library and didn't mention how to see output. Well i figured that guy who would know answer, would know that
 
11:52 PM
Well I finally can actually reproduce the code, and it works for me. It has 5 rows in the 3rd and 4th columns. Sure, it looks weird but what specifically are you trying to do @AjGauravdeep?
 
that's all i am trying to do. Why doesnt it look weird?
Is there a way to share snapshot here?
 
That's what you want right? Or do you want to divide the table columns 3/4 into 5 rows?
 
i also reached the same place... I did that by using table inside table.. Those cells with 1-1 values should not have top bottom left right padding..
Thanks again for trying this out.
How did you attach that screenshot?
 

« first day (1784 days earlier)      last day (3167 days later) »