« first day (1867 days earlier)      last day (3095 days later) » 

1:31 AM
Okay. Found one interesting question. I am not even sure if my answer is correct. Please share your thoughts people.
0
A: Get/Search reference of element in set

thefourtheyeSets are basically containers which are generally used to collect unique items. They are not ordered and the individual elements are not directly accessible. So, getting an element from a set is not possible. One possible solution would be using set intersection operation, like this {Resource("...

I have a feeling that I have totally overlooked something.
 
1:54 AM
I am not the only one.
1
Q: Tabs with multiple tags automatically become modified

SteveThis is starting to happen on Edge (the same also on IE11) today. I have made a Tab with 4 Tags with the ANY option. When I click the tab, the star (*) symbol automatically appears on the left of the Tab caption and the button SAVE becomes enabled. Saving the Tab seems to works but just switch...

 
 
3 hours later…
5:19 AM
Morning CBG all
 
 
2 hours later…
7:40 AM
@thefourtheye I don't think you've missed something. It's an elegant solution to the question as posed, even though, as you say, it seems like the wrong data structure and dict is the real answer
 
@JRichardSnape Cool. Thanks for taking a look at it :-)
 
Hi
 
8:11 AM
Hey up all
 
Cabbage humans :-)
 
8:46 AM
@thefourtheye cabbage, fierce puppy
 
@Sword Awww :-)
 
9:03 AM
pang
anyone know a javascript mobile lib that'd provide a <input type=file> or similar with cross-browser compat,
 
Getting a strange error in sql module. I have tried to reinstall the module twice and still getting this problem.
Traceback (most recent call last):
File "C:...\prok_test1.py", line 3, in <module>
from mysql.connector import *
AttributeError: 'module' object has no attribute 'CMySQLConnection'
any idea on whats going on?
 
could you have a conflicting module by the same name
is this python 2?
 
python 2.7
 
Do you have a file called mysql or something?
 
which is the actual error line?
 
9:07 AM
Do you mean conflicting module in the import module list?
I have the mysql file in the site packages file
its just started today
yesterday, no problem.
 
is that all of the traceback??
 
today. *ack!
 
4 lines?
 
Thats all the traceback
 
or did you remove something
 
9:08 AM
Like I said, worked fine yesterday. I started up today and ran the program just to see it working and ack! I havent changed anythign.
my windows 10 had an update last night
could something have messed up? doubt it tho
import re
from mysql.connector import *
from collections import Counter
from string import punctuation
from math import sqrt
Those are the modules I am importing. I cant see there being a conflict
 
@GenGen uninstall and reinstall your the mysql-connector package
 
ok, will try it again
So uninstalled it, removed any strangling files related to the mysql module and re-installed it. Got the same traceback error
going to try my script on another laptop that essentially has the same setup as mine to tripple check the script
 
the error message does not make sense, there is no CMySQLConnection in from mysql.connector import * ... that's why it seems your traceback is abbreviated or there is something a lot more onerous going on which we can't see from the traceback
 
well I ran the script on my unix laptop with same python setup and it works fine there.
So its something messed up on my windows laptop
Only thing I can think of is uninstall python -everything- and reinstall
any other suggestions?
 
This gets a upvote stackoverflow.com/questions/33934923/… and answer gets 4 upvotes a lucky day for both :P
 
9:42 AM
Guys I'm having a hard time deciding which GUI frame work to use for my crosspltform app
Qt or WX?
 
kivy
 
@GenGen reinstalling everything is probably overkill but without more details, it's hard to tell where to look
a common problem is if you have multiple directories with the same name which overlaps the Python module path
 
hmm.. I do have a kivy install in a different directory that houses its own python 2.7
but why would that have the problem impact now?
 
a significantly less intrusive fix would be to install a virtualenv
if the hypothesis is correct, this is likely to coincidentally fix it
at the expense of some duplicated modules, but you can reduce that with some options, too
 
10:08 AM
Thanks for whoever posted the str.maketrans method. This just reduced my script size. See my answer and question
0
A: Translating from English to Entean

user3620828I found the str.maketrans() method in Python3 and have updated the code. FULL_ENGLISH_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" FULL_ENTEAN_ALPHABET = "AZYXEWVTISRLPNOMQKJHUGFDCB" FULL_ENGLISH_ALPHABET += FULL_ENGLISH_ALPHABET.lower() FULL_ENTEAN_ALPHABET += FULL_ENTEAN_ALPHABET.lower() tran_t...

 
10:23 AM
I can't get pdoc to work in windows from commandline. Just installed it with pip, and it installed fine. I can import it as a module in python. I have python/Scripts in my windows PATH, so I can use pip and pyinstaller from CLI fine. In the Scripts folder there is a pdoc file, but it has no extension. There is no exe. Any ideas?
 
@tripleee and @Ffisegydd I figured it out. Something did corrupt the MySQL (still unknown) I have been re-installing the 64bit for python mysql. I just figured 'f it. let me try re-install the 32bit version just to see what happens' and now it works fine.
I cannot tell you why, or how or what only that it works and I am not going to open pandora box to find out why
 
Cabbage all
 
I'm having trouble with backwards compatability and google is not helping
try:
    tran_tab = string.maketrans(FULL_ENGLISH_ALPHABET, FULL_ENTEAN_ALPHABET)
except:
    tran_tab = str.maketrans(FULL_ENGLISH_ALPHABET, FULL_ENTEAN_ALPHABET)
Is there a way to use str in python 2 directly
I don't know if its an ideal practice to use try and except for python 2 and 3 compatability
 
10:40 AM
I have seen the six library for cross compatibility, but unfortunately here it seems to have a problem with maketrans
You could do something like this:
import sys

PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3

if PY2:
    import string
    maketrans = string.maketrans
else:
    maketrans = str.maketrans
Caveat - I haven't tested (slaps wrists) but the idea is to alias maketrans to the appropriate version at the top of your script and then use it further down just as maketrans()
 
I have the following and your code seems longer. I want to know if this has any problems
try:
    from string import maketrans #for python 2
except:
    pass
try:
    tran_tab = maketrans(FULL_ENGLISH_ALPHABET, FULL_ENTEAN_ALPHABET)
except:
    tran_tab = str.maketrans(FULL_ENGLISH_ALPHABET, FULL_ENTEAN_ALPHABET)
 
Someone with better knowledge of 2/3 differences will probably come along soon and tell me off!
I prefer not to use try...except except where things are... exceptional. That's mainly a style choice, though. Your way might suit you better. You can still alias the maketrans to avoid the second try...except
e.g.
try:
    from string import maketrans #for python 2
except:
    maketrans = str.maketrans
then you just use maketrans wherever you want it, with no try...except. The key thing to get hold of is that you can assign a function to a variable name just like a value, so you don't litter your code with tests for 2 vs 3 (whether they are if..else or try..except
(When I say litter, I know in your case it's only once, but in the more general case it can make a difference)
 
11:37 AM
Cabbage!
 
12:14 PM
Meh, I hate that. I want to look something up, open a new tab, and have forgotten what I wanted to look up.
 
I always default to stackoverflow.com in such cases
 
12:36 PM
Not that I know of
 
Thought there would be one. Answered it since I was not able to find a dupe
 
1:04 PM
@Wally :) That looks nice to me
@poke happens to me all the time. Often followed by - becomes a little distracted, does some tangentially relevant stuff in new tab. Forget what I was doing originally. Not painting a good picture of my productivity, I know.
 
1:30 PM
cabbage
 
cbg PM
 
I've had a "fun" day trying to get an ADSL modem and a wifi router to co-operate. I was hoping to just be able to connect the router to the modem, and while I was able to go online it had timeout problems, mostly when clicking Submit buttons. So I could browse SO but I couldn't write / edit answers. After trying a few zillion combinations of settings I finally put the modem into bridged mode and it seems to be working ok now.
I think. :) I just got a timeout error when I first tried to submit that last post. (Stupid hardware... :grumble: )
 
lol ... The router's playin with you :)
 
@RNar Thanks for that link. I managed to get an accept & upvote out of it, even though I still don't quite understand the OP's question. :)
 
Thank you for putting all that time and effort into answering my question. I'll give it a shot. I really appreciate your help. — Mike Issa 23 hours ago
 
1:44 PM
epic fail. copied some cdn urls from bootstrap
which had an integrity check using sha-512 checksumming
and ofc the cksum was wrong.
 
lol :D
 
*sorry 384 :P
here
of course they're wrong
 
@Dan That is unfortunate. It may help if you can add a small sample of typical file contents to your question (if there is such a thing as typical file contents...). And because the file contains a mixture of UTF-8 text and arbitrary binary data it's probably a good idea to show us the repr() of the raw (undecoded) file data. So don't use the codecs.open(), just use the standard open()in binary mode.
@BhargavRao It's nice when you get feedback like that. I might try answering more neglected questions. It's certainly less stressful than the FGITW strategy.
 
@Dan seriously, you've screwed now. If there is binary data, then surely there is all other kinds of bytes there (including \r and \n)
 
@PM2Ring Yep. I had got a feedback like that once. :)
 
1:55 PM
@AnttiHaapala Oh no! Bad checksums aren't exactly confidence-inspiring. :)
 
@PM2Ring it is the same link
 
@BhargavRao And thanks for the upvote. :)
 
@PM2Ring see the middle link,
the theme.css.
 
@PM2Ring The answer is worth the vote :)
 
getbootstrap.com/getting-started/#download-cdn says sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX and srihash.org says sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r
idiots
 
Dan
2:08 PM
@PM2Ring I'll do that
@AnttiHaapala long story short, I'm conducting forensic analysis of parsed event log data, and I believe someone intentionally placed binary data in the event logs via a rogue application for nefarious purposes
 
:D
text logs <3
 
Dan
@AnttiHaapala I'm not screwed, there are no \n or \r because those get handled by a previous script that actually parses the data into cvs format
but anything else gets passed through
I didn't know about the \v issue (\x0b)
and I don't have control over the previous script
 
mmmso why not read in binary and split using b'\n'
 
Dan
@AnttiHaapala because some of the files are utf-8, some cp1252, some other things
i guess that wouldn't stop me tho
hang on
 
Dan
2:22 PM
@AnttiHaapala @PM2Ring ok I updated with sample data: stackoverflow.com/q/33906245/868044
@AnttiHaapala only the very last row causes issues
the other rows are handled fine
I just think the last one happens to have the ugly \v // \x0b char
i have a utility that parses the event logs into cvs format i use
then i am writing a utility that takes that output and uploads it into elasticsearch
a text editor doesn't insert a line break, only python does
 
@Dan Do you have to use that previous script? That data really should be read in binary mode. And then you can attempt to decode parts that may be UTF-8 or cp1252 encoded. Getting codecs.open to decode the whole thing is just going to make it a worse mess than what it currently is.
 
Dan
@PM2Ring I do have to use that previous script, but I don't have to use codecs
@PM2Ring that's how I get the Windows event log data into CSV format
with a lot of other helpful information
there are python libraries for parsing event logs but they don't do as good of a job
 
2:47 PM
pff the hard part of "programming": deciding your IDE
hi everyone btw :)
 
Dan
@paul23 hello, and the answer is pycharm :P
 
@Dan Well that's obvious - especially since I'm a student -. But nah I need to make a report again.
So need to get a xeLaTeX editor. Can't decide between texstudio & texmaker
 
Yeye reading that
 
2:51 PM
but all those topics state: "well they look almost the same, work completelly different under the hood but have actually also the same feature set". So choose one you like.
 
Dan
@paul23 I use Kile on Debian/KDE
 
But it's funny, I always waste several days in each language I use finding the correct IDE & learning the basics of it.
 
So many projects still use SF
 
Dan
@AnttiHaapala @PM2Ring @JoranBeasley I wonder if the CSV module would have the same issue, I probably should have tried that already :P
 
3:14 PM
Hi ! Any Odoo fellows here ?
 
@yann keep getting emails from them asking me if I want to be a reseller - but haven't touched it - so don't know if that counts :p
 
@JonClements I guess not :/ There are so many questions and so little answers... I which the Odoo community was better... thanks anyway
 
Are you sure your query is specifically regarding Odoo or could it just be a plain ol' Python thing?
(for instance - a lot of Django questions aren't specifically Django)
 
Well, this is about sessions, I'll post the link of my question on the community, I guess someone will remove it if that's forbidden odoo.com/fr_FR/forum/help-1/question/…
 
DSM
3:50 PM
Thursday morning cabbage.
 
Dan
cbg
 
I too, will join this cbg train. Cbg
 
Dan
@Programmer next stop, asparagus
all aboard!
:P
it would have been simpler to just test ideas on sample data in a separate project
instead i have a git branch for every idea
i'll the merge the best and hose the rest
but much more tedious this way
 
DSM
Most of my projects wind up having a sandbox in master.
 
Dan
4:13 PM
@DSM we don't touch master
we have a dev branch, then feature branches are created from the dev branch
then merged back into dev
 
I was hoping to sneak in a few answers but that isn't going to happen.
 
DSM
@Dan: okay, then in your framework I guess I'd have a sandbox in dev.
 
Dan
@DSM makes sense
 
4:36 PM
@Yann Workaround: rewrite a method so that it passes extra arguments to other objects methods... I guess modularity is a neverending quest
 
@DSM I seem to always end up with a branch called "blah"
 
5:00 PM
Rhubarb
 
Dan
@Yann rhubarb
 
5:16 PM
@MatthewRock: I can't comment on Python 2, sorry. As far as I know, there's no unicode.whitespace or equivalent. — vaultah 1 min ago
Is there anything like string.whitespace for unicode?
 
@vaultah I believe there's a "named" range for it
 
Any idea how to access it? Is it in unicodedata?
 
DSM
Could use ''.join([c for c in map(chr, range(0x110000)) if c.isspace()]) manually, I guess.
 
5:31 PM
/ OFF
one of my collegues' english book has the following task: (you should write a single word on the dotted lines) and none of us can solve it :P
> What can mirrors tell us about our self-image? Researchers have discoverd that being aware of a mirror on the wall can influence the way we behave and if this research (1)....... to be believed, always (2)....... the better.
what words should be put in the two fields?
/ON
 
(1) is probably "is"
 
that was our tip as well, but that sounded soo off for us..
but we had no clue for the second one..
 
DSM
"always is the better" is very unusual. I'm not saying you'd never have those four words in that order, but only in the most poetic contexts.
 
(we guessed (2) == "for")
 
yeah I was going to say 'for' as well
 
DSM
5:36 PM
Oh, wait. It never said it had to be the same word on both lines.
I was trying to figure out a word that would fit for both..
 
clever :)
 
I would say for.
 
DSM
Yeah, then "is to be believed, always for the better" would be perfectly natural.
"were to be believed" is another option, I guess. But "have discovered" is already making a bit of a commitment to the truth of the claim, so it doesn't sit as nicely with "were".
 
> My god, it's full of options!
 
yeha but that mixes tenses and sounds kinda passive voiced
 
5:43 PM
well.. thanks for all the help -- I think she would go for "is" and "for" :)
 
DSM
I've notictg wrong-window error again. :-/
 
6:17 PM
@DSM I wish there were an eye-tracker => wherever I look, that window would be active :)
(same goes for tabs as well..)
 
May 20 at 16:19, by Bhargav Rao
Oh Damn! Had 66 tabs open and wrote answer to the wrong question
rbrb
 
http://stackoverflow.com/questions/33944904/importerror-cannot-impor‌​t-name-timezone-in-python-3-4?noredirect=1#comment55649065_33944904
 
6:47 PM
cbg
stackoverflow.com/questions/33944904/… this is a prime example why python 2 must die
 
he said he was using python 3 but the fact that he closed in voluntarily kinda makes me suspicious haha
he also replied with the snarkiest comment so ouch takign it personally
 
re-cbg
To specify more than one return types, is the following syntax correct?
def foo(client_id: str) -> Union[list,bool]
Or have I misunderstood the docs completely?
 
7:05 PM
seems right, "A type factored by Union[T1, T2, ...] responds True to issubclass checks for T1 and any of its subtypes, T2 and any of its subtypes, and so on."
 
Fine ... Added answer
 
DSM
7:42 PM
typing blek.
 
But I know type hints still work for Python 3.4 as well i.e. def foo(id: str). Isn't this also type hints? — Yahya Uddin 5 mins ago
Isn't that Function annotations?
 
DSM
8:03 PM
"Type hints" are a standard pattern/language for annotations. Even in 3.4 you can do
>>> def foo(a: int) -> (object(),3): pass
...
>>> foo.__annotations__
{'a': <class 'int'>, 'return': (<object object at 0x7f90a8752100>, 3)}
And since even in 3.5 they're not enforced, I don't think YU's comment is right.
 
I'm trying that out in Py3.5 ...
>>> def foo(a:str) -> list:
...     return("Works")
...
>>> foo(1)
'Works'
Yep, they aren't enforced.
 
DSM
My views that this is not a great direction for Python remain unchanged.
 
>>> foo.__annotations__
{'return': <class 'list'>, 'a': <class 'str'>}
They are going backwards :P
 
DSM
When people have to go out of their way to assure you that they're not trying to turn Python into Java, that tells you something right there..
 
> I will have more information tomorrow when I have my actual code.
We need to wait till tomorrow to answer :D
 
8:17 PM
user image
7
 
Lol, There was another image that Kevin used to put, but this is better :D
 
DSM
This is wrong in so many ways.
 
B.. Bu.. But the images are so nice. ;_;
 
9:03 PM
this question is so confusing in so many ways what is happening
 
9:20 PM
hello python! Is it possible to have a "copy" of pip in a python pyvenv?
in the doc there a metion of it: with_pip – a Boolean value which, if true, ensures pip is installed in the virtual environment. This uses ensurepip with the --default-pip option.
but it gives: venv: error: unrecognized arguments: --default-pip
 
@vinni_f pip will be installed by default if you create a venv.
 
DSM
virtualenv does; does venv? (I stlil use virtualenv.)
 
virtualenv does it yes
venv not...
there must be a way
[user@box]$ find vfi-env/
vfi-env/
vfi-env/include
vfi-env/lib
vfi-env/lib/python3.3
vfi-env/lib/python3.3/site-packages
vfi-env/bin
vfi-env/bin/python3.3
vfi-env/bin/python
vfi-env/bin/python3
vfi-env/bin/activate
vfi-env/pyvenv.cfg
 
does anybody else find it odd that you can edit a post (post 2000 rep) without having to get it approved, by approving an edit takes 3 people to approve it..?
 
9:39 PM
approving and edit is a vote for the editor, less your action (the edit)
 
sorry, i meant "BUT approving an edit"
 
9:55 PM
@RNar no.
 
I'm not able to edit this answer to put the code in code blocks
It says less than 30 characters :/
 
 
1 hour later…
11:13 PM
@BhargavRao there. fixed it
 

« first day (1867 days earlier)      last day (3095 days later) »