« first day (1388 days earlier)      last day (3786 days later) » 

06:04
cbg all
06:23
cbg
06:39
cbg
06:50
how goes it puppy?
Sad :( Have to work in JAVA
poor, poor puppy... throws a scooby snack
Grabs it and runs to a corner
Cabbage ma pups
@Ffisegydd STEWIE!!!!!!!!!!!!
06:55
@Ffisegydd STEWIE!!!!!!!!!!!!
did you copy and paste that @thefourtheye :)
he he he, yup... ;)
@Ffisegydd do you think it's worth attempting to call a meeting some time mid-month to discuss sopython.com and its progress?
wow - 100 years today since Britain entered the first world war
@Jon Briiiiiiiiiiiiiiian!
@thefourtheye Briiiiiiiiiiiiiiian v2.0!
@thefourtheye haha... I got the @ and you didn't... hahaha puppy :)
07:04
Wow, I am the advanced Briiiiiiiiiiiiiiian ;)
growls :)
@Jon possibly. Though I'm not sure what there is to discuss really. v1.0 is done and work is being done to upgrade it.
One of the most important things is to get it working for other people
So they can play with it and help if they so wish
07:08
@Ffisegydd what I thought - feel completely free to disagree; you're at the helm now. Is it might be worth scheduling a meeting on the chat system here, and it might be possible to interest the other sub communities of the SE network kind of thing...
I need to speak to davidism about it really. I think it might be better if people looking to help issue PRs rather than work with the main branch directly. As there might already be plans in place for certain aspects etc
@Ffisegydd +1
Well why would other communities be interested in sopython? If it were discussing Nidaba then yeah I think it would be good to show it to people.
I was thinking about Nidaba... it could benefit the other sub communities and we could possibly receive input about attempted efforts - some have bots and other automated systems to announce dupes and such - we could draw from and share some experience perhaps...
and good developers don't use a single language, so we possibly may get some cross experience re: PRs
and we might get people who have a lot experience in ML
07:23
Exactly. We may be doing this specifically for Python and it's written in Python - so what? It's a tool to help communities on SO more effectively work.
Other communities could use the sopython-site stuff now to set up chatroom rules and FAQs and such - so it's already more than useful
How do we advertise this?
Yeah that's true.
I see your point and agree.
If we get enough interest/attention then we possibly gain more contributors
Or if not contributions, then advice
I'm going to be walking to work so will be moderately afk. But yeah it's a good plan.
@Ffisegydd walking to work - who does that? :)
Mind you - I do walk 10 metres to work... :)
07:28
Cbg :)
@JonClements cbg ;) - I did as well today! :D
@IanClark good morning Evil/Good Ian :)
Should we bark at him?
In a friendly, tail-wagging way
@thefourtheye you bark, I'll just growl slightly
@Ian still enjoying the new position?
@JonClements We should come up good puppy/bad puppy routine...
07:30
@thefourtheye hah!
@JonClements yeh going really well actually, new responsibilities and a big challenge :)
@Ian sounds fantastic - working out well - I'm pleased for you
:D TY
@JonClements how about you? You're doing something new too? I've only really read snippets (such as the new car?)
07:46
oh... in a few months, yes :)
Going to be fairly weird managing a team again :)
Which given the current population of the room means you @thefourtheye :)
Heeyyy I chipped in too!
Okay Evil Ian... we still love you too! :)
Wow - how the heck has that answer got 2 upvotes
@Antti it's low quality - but I don't consider it close worthy
@JonClements on the contrary, it does not have any problem, it is completely unclear what you're asking.
also, if there is a "if, elif"
then the msg for yaw is never printed :D
@JonClements whereas the your cv pls above is not cv-pls offtopic, as it had very clear error there.
@JonClements also that one does not say what is the correct thing to print, only that there should be 1 msg :d
I haven't posted a cv-pls :) I posted a dv-pls
downvote :?
:D
I read it as cv
delete vote
08:25
why downvote?
I have been given an assignment which says that os.execvp() must be used to invoke the commands. — Anmol Wadhwa 1 min ago
Wow....
oh well... gotta run for a bit, rbrb for now
08:41
It's "ill-advised" by the way :)
08:53
interesting accepted answer on that one :)
09:33
@Ffisegydd I've added trello.com/c/umbpnPJ8/…
Ok ta, I'm going to move your text into the "Description" box so it's at the top
ok
sorry mate, not use to trello
No problem puppyista.
@Ffisegydd anyway - it's down to you really. I can't think of any negatives at the moment of doing so...
user559633
puppyista :3
09:46
@JonClements :P sry
@JonClements had I not emboldened then you would also not have seen it
I also wrote insident today :(
but then again... it is hardly my fault that English is so fscking complicated.
It's supposedly the hardest language in the world :)
too many damned words to write incorrectly
Really? English is the hardest? Not Japanese?
ofc you need to do things like deceit vs receipt to keep non-native speakers on their toes...
user559633
i don't really understand why execvp would be useful.
09:56
@tristan?!
explain
actually the syscall is execve
the unix model is thus, there are 2 syscalls: execve and fork, and thatsit
user559633
related to this question on os.execvp in which asker claims he was forced to use it in an assignment. why replace the current proc instead of just terminating the "bad" one
user559633
execvp. not execv_e_.
the point is in that, the execved process, in replacing, will also inherit all the open files already, including 0, 1 and 2.
execvp is wrapper for execve
user559633
ah. subsume and continue. got it. cheers :)
In computing, exec is a functionality of an operating system that runs an executable file in the context of an already existing process, replacing the previous executable. This act is also referred to as an overlay. It is especially important in Unix-like systems, although exists elsewhere. As a new process is not created, the process identifier (PID) does not change, but the machine code, data, heap, and stack of the process are replaced by those of the new program. The exec is available for many programming languages including compilable languages and some scripting languages. In OS comma...
10:00
Why is this a dupe when it was asked in 2010 and the "original" in 2012? stackoverflow.com/questions/3481554/…
user559633
time continuum collapsed upon itself
seems legit
@IanClark bc the original is better?
@AnttiHaapala no, not saying that either is "better" (though Alex Martelli answered the original) - just because it seems unfair to the OP to close as a duplicate when it's clearly not
@IanClark it does not matter :D
10:03
"Duplicate" status doesn't matter when it comes to time.
Instead the "original" should be the most awesomest.
5
Q: Which of 2 similar old questions close as duplicate?

Michael FreidgeimThe perfectly written FAQ How should duplicate questions be handled? doesn't describe the case if you have 2 old questions, which one should be considered as original and which as duplicate. I previously expected that it should be a simple formal approach - older question is an original and newe...

Well then "This question has been asked before and already has an answer" is misleading
well, before you can read 2 ways
@Antti ahh... you got the tick mark after all - was confused why the OP chose the other one
10:46
May be of interest to some:
Awww boards don't one-box D:
ummmmm.... why did my phone just bleep regarding someone uploading a video on youtube - never had that before
not even a channel I subscribe to
11:24
cbg all
cbg all as well
user559633
I need a context in which I can post this: youtube.com/watch?v=7aVcisdS8X0
pikachu!!!!!!!!!!!!!!!!!!!!
I want to display all images from my static folder onto the webpage, and make it editable. I am using Flask.
I do have an endfor for closing the for block. but the file is not being shown.
11:43
You'll have to list your images yourself; do a os.listdir(app.static_folder) to produce a list of filenames in your static folder.
i want to display them all... and make them as link.
i am using glob
right, and you are certain that images is not empty?
yes they are not empty.
@app.route('/scan')
def scan():
    images = []
    for filename in glob.glob('static/*'):
        images.append(filename)
    return render_template('show_images.html', images=images)
Note that glob there is overkill when you use *. So is using a loop and .append(), glob.glob() already returns a list.
You are also assuming that the current working directory is your Flask folder.
11:47
You can use os.listdir(app.static_folder) and get a list of filenames in the static folder, where app.static_folder is an absolute path to the folder.
i changed that.
 {% for name in images%}
     <img src="{{ url_for('static',filename=name)}}">
  {% endfor%}
In your template, verify that the list is not empty by just interpolating it:
{{ images }}
okay
i have some images, which i need to show on the web and have them processed by the user, should i store them on the static folder or save them elsewhere?
Also os.listdir, does it have any filter so i can only get image files and exclude others?
12:03
image_ext = {'jpg', 'png',' pdf'}
images = [file for file in os.listdir(...) if os.path.splitext(file)[1] in image_ext]
i saved images in separate folder inside static folder and gave path to it.
That should work. It uses a list comp to iterate over the iterable returned by os.listdir but only adds it to your images list if the extension is within image_ext
@app.route('/scan')
def scan():
    static_folder = app.static_folder
    images_folder = static_folder + "/images"
    images = os.listdir(images_folder)
    return render_template('show_images.html', images=images)
@tila why bother creating the variable staticfolder?
hmm...to make it clear..: )
i guess that is bad practice..
let me change that.
12:06
app.static_folder isn't clear?
:P
: ) sometimes i folly in my code
12:18
Today I am fixing a bug that was caused by my own stupidity.
If the me of six months ago had put an additional ten seconds of thought into writing this query, I wouldn't be working on this now.
{{ images }} gave an error when images is a list, i will need to do a for loop?
user559633
Oh neat, flask talk. How do I add arbitrary HTML elements to a div? E.g. ` <input type="email" class="form-control" required autofocus>` the required, autofocus
user559633
yes @tilaprimera. {% for image in images %}<img src="{{ image.url}}">{% endfor %}
Augh, beaten by Martijn by five seconds. I hate Mondays.
(Not that I'm any faster on Tuesday through Sunday, mind you)
img.url gives url?? it gave a blank src url
12:28
img.url, or image.url?
image.url
@tilaprimera image is a string (assuming you've passed in a list of strings)
So image.url means nothing as a str doesn't have an attribute url
ditto
: ) thanks
I don't get why people keep saying Python's __init__ isn't a constructor.
That's because I don't believe it is? Isn't __new__ the constructor?
12:40
How many languages' constructors are responsible for actually creating the object they initialize?
65
A: Python's use of __new__ and __init__?

vartec__new__ is static class method, while __init__ is instance method. __new__ has to create the instance first, so __init__ can initialize it. Note that __init__ takes self as parameter. Until you create instance there is no self. Now, I gather, that you're trying to implement singleton pattern in...

Then again a same answer to that question agrees with you stackoverflow.com/a/8665179/3005188
certainly __init__ matches much of that which a constructor does
__new__ doesn't seem like a traditional constructor to me. It's like a combination allocator/semi-constructor.
but then new is the constructor of immutable types
so then it is the only real constructor
so both of them are together the constructor, and neither of them is a constructor...
words mean whatever you want them to mean. Descriptivism!
12:51
@JonClements @JonClements ah OP chose the other bc it was the relevant answer - after reading the comment I then modified my answer.
My coworker keeps making changes to the database without checking the new scripts into version control ;_;
Invite him to play some "Pass the Shuriken" without his permission.
Now instead of telling the DBA "run this script which will fix my broken table", I have to tell him, "find the last script that created the table, ctrl-F for this comment, and replace the following five lines with these five lines, then run it again"
Since I don't have the last script.
I guess I could stop working entirely, and just say "still waiting for X to give me the updated scripts" during our progress report meetings. Doing nothing has a certain appeal.
@Kevin alembic
also, do so that no one has access to the db :P must execute the versioning from a git repo
Hi everyone! I've asked a question stackoverflow.com/questions/25118862/… that is not receiving enough attention, can anyone help me with that? Thanks
13:05
@MostafaShahverdy please see sopython.com/pages/chatroom
In particular: please don't link newly asked questions into chat.
Oh
sorry about that
13:20
in the server side i am using flask, what is the preferred practice to use on the client side to handle the client's actions such as button click and all.
javascript?
beside javascript?
What do you mean by "handle"?
Let's see, what other client side scripting is available... Flash?
Because if you mean "change something due to a button being pressed and do everything clientside" then I think JS is it.
Or Brython.
13:22
: )
i want to use something that python community prefers.. so asking about it
If you just want "when the user presses this button, it submits the form" I'm pretty sure you don't need any scripting at all
Use JS.
: ) thanks
You should use the appropriate tool for the job, in this case it's probably JS.
noo not submit form : ) i need to get coordinates of the click action.
13:23
Use JS. There will be libraries for this kind of thing.
aye aye captain!! : )
Does anyone know a nice way to take a float and convert it to scientific notation?
I know you could do {:e} formatting but that'll give you '5e-6' when I want '5x10^-6'
I know I could work out the log and then do calculations etc but was wondering if there was an easier, builtin, way.
Dunno. "{:e}".format(x).replace("e", "x10^")?
Hmm. Yeah that'll do.
OP should be using e anyway.
Supposing that the ":e" option always returns a number with an e in it.
I don't know if 1 gets displayed as 1e0 or what
13:28
It does I believe.
13:47
cbg
cabbage to all 'fine people of the Python room'! (quote from the ol' Kneel-Before-ZOD mate)
(I haven't seen him for a while in here..)
def func(**kwargs):
    for variable in kwargs:
        Object.variable = kwargs[variable]

#Current behaviour
>>> func(a=1, b=2)
>>> Object.variable
1
>>> Object.a
AttributeError: type object 'Object' has no attribute 'a'

#Wanted behaviour
>>> func(a=1, b=2)
>>> Object.a
1
>>> Object.b
2
How should my func look like here:
I bet setattr would be good there
class Object:
    pass

obj = Object()

def func(**kwargs):
    for name, value in kwargs.iteritems():
        setattr(obj, name, value)

func(a=2, b=3)
print obj.a
print obj.b

#result:
#2
#3
AttributeError: 'dict' object has no attribute 'iteritems'
14:00
Oops, I guess that's 2.7 only? Maybe it should be just .items() for 3.x
And parenthesize the prints, of course
it's just items in python 3. thanks @Kevin
@Kevin are you still using 2.x most of the time?
Yeah
Although the frequency has dropped now that I know you can do py -3 myfile.py and not C:\Python34\bin\python myfile.py
I hate typing slashes. Who thought it would be a good idea to assign all these symbol keys to my least dextrous finger.
;)
it is interesting.. I always thought you like the bleeding edge => switch to 3.x ASAP
Well, second least dextrous, I guess. The left pinky has an easier time, though, as it only has tab/shift/Q/A/Z, as opposed to Enter and Shift and -p;.=]'/\
@PeterVaro I like whatever has the best documentation :-D
14:08
— but it has...
Maybe at python.org, sure. But there are a lot of secondary sources that still have unparenthesized prints in all their sample code.
An email from a client: "can I use photoshop to make website?"
Well, you can encode arbitrary binary data into a bitmap, if you skip the header.
So, depends on whether your browser will skip the junk preceding the <html> tag.
@corvid one can -- there are several tools to convert PS layers intros HTML/CSS
there are even free ones out there
she meant making the back end, the thing I'm doing in flask right now
14:17
well.. you can write code in a PS text-box.. however,... it will be very uncomfortable, won't it? ;)
cabbage
cbg @davidism
@Ffisegydd I've been really busy, but I noticed you added a bunch of stuff to the review and docs lists :)
@davidism yeah I've been doing little bits and bobs.
14:32
morning davidism
14:48
Today's pet peeve: when a post has only an error message as a title, and the body explains they got it while trying to install a third party library. I can solve ImportErrors if they're typos or version issues, but not if you forgot to tick a check box back in installation step 3 of 200.
Is "ImportError while installing oauthlib" so much to ask?
How do you pass a variable from a python script to a bash script?
Perhaps you can pipe the output of the first to the input of the second with myPythonScript.py | bashscript.
@MOS182 many ways, best to give it in the environment for the subprocess
or command line argument
I'm currently trying to pass this os.getcwd()
it is not a variable
and it is passed automatically
ought to
14:53
Okay hold on. This is the variable: path = os.getcwd() + "/arrayscripts"
The python script running this is in a different directory than my bash script
better to use: os.path.abspath('./arrayscripts')
Why @AnttiHaapala
bc it is righter :D
Can you explain why?
I don't know how to pass this variable from this python file to the bash file I want it in
I actually have 4 bash files which I plan to use the variable
give it as a command line argument
14:56
zealous solution: convert all the bash scripts into Python scripts. Then you can simply import them and execute whatever functions you require.
+1
there is not mcuh that is easier done in bash scripts
Whenever I see a question like "I'm trying to pass a variable from Scripting Language A to Scripting Language B", I always think, "why not just use one scripting language?"
easier to do pipelines and redirect random filehandles here and there maybe yes
but people who DO that in bash, then also do not need answers to "how to pass a variable from python to bash"
I don't have a great level of experience with both bash or Python and so don't know if certain bash commands are available in Python
such as monitoring processes
I suspect the reasoning is usually, "some of the scripts are huge monsters written by my predecessor and I don't want to touch them". Totally understandable.
15:00
@MOS182 ask, then get an answer
I've been told to use the bash scripts which produce output in binary, csv and txt.
bash for binary :??!?
If conversion isn't possible, I second "give it as an argument to subprocess.call"
srsly bash sucks balls for binary and csv
Whoever told you you have to use bash, tell them, "I am an artiste, how dare you tell me what technologies I must use!"
Then throw your beret at them contemptuously
15:05
:D
I sort of want to learn both Bash and Python I know other jobs use Bash as well
so having a bit of knowledge of both is good for me in case I ever come either a python or bash script
Like if I only knew Python, I wouldn't know what to do with a bash script but by doing both I'll have a bit of an idea
cabbage
srsly there is no reason to use bashscript for much anything where it would be about programming...
Depending on the job market in one's area, "I will learn this technology I don't care about so I can get a job working with this technology I don't care about" may be unwise
@Kevin that is what makes an artist great. very important move, I should say ;)
15:09
It's all in the wrist.
the main uses of shell scripts are: writing shell extensions, writing 5 liners, writing run-anywhere installers.
none of them requires you to pass variables from python to bash scripts that you would write :d
@MOS182 you can use the sh library to make shell calls from python pretty easily.
@room not sure if there's a more recent library than sh, if you guys know
Dunno. I just make do with subprocess.
price = driver.find_element_by_css_selector('.number.totalPriceAmount')
whenever i try to print price.text , it prints nothing
prints none
@odaialghamdi perhaps because it couldn't find any element by that css selector
15:12
<span class="number totalPriceAmount">
1,180.00
</span>
thats the element
ah dont like the sh library :d
should workwith pipes :D
@AnttiHaapala why?
I thought it did, unless I'm thinking of another library.
sh.ls | sh.grep('pattern')
:d
@Kevin looking at subprocess.call atm, which is what I do to call my scripts, how do I pass through the variable and then call it in the bash script?
15:14
subprocess.call( os.getcwd() + "/arrayscripts/" + file, shell=True)
@odaialghamdi, what is the result of print(type(price))? What about print(dir(price))?
@MOS182 subprocess.call(os.path.abspath(os.path.join('arrayscripts', file)))
:P
@MOS182 It would look something like subprocess.call([myBashFileName, argumentToBashScript], shell=True)
not sure if shell=True is required there, I can never remember what it does.
That's the "twiddle this option if it doesn't work the first time" argument
Okay but what about in the bash file @Kevin, how do I use the argument? Just use $argumentToBashScript ?
15:16
you never want to use shell=True basically
Why @AnttiHaapala
bc it never does what you want
@MOS182 Not sure, as I know nothing about bash. You would want to get the first command line argument somehow.
it is the "now I release the safety, aim at my foot and pull the trigger"
@Kevin how does it feel to have 10, 11, and 12 starred posts simultaneously?
15:17
command arguments are $1, $2, $3 ... and so on
I want stars too, I still miss the silvery badge :(
@davidism I feel like I am valued :'-)
someday I'll say something really cool, then I'll know :'-)
I already value you :-)
I wonder if Hallmark has a "you've incrementally improved the quality of our room" card...
@odaialghamdi That's unusual. So price is a string. Maybe you want just print price rather than print price.text.
I would expect find_element to return some kind of Node object...
this documentation leaves much to be desired! Return value types plz
selenium documentation is awful sh*t
Ah ha, return type WebElement. Hmm, why did type(price) give unicode, then? Most unusual.
15:39
@Kevin are you still running for the "100 consecutive days gold badge"?
it is easy
if you set up stackoverflow as home page everywhere including mobile phone :d
I just got it this morning :)
my first gold badge
congrats :P
I'm 1 day away from it
too bad it's the boring easy one, but at least I didn't cheat @AnttiHaapala ;)
@PeterVaro I'm trying to time it so I get the badge during the Winter Bash. I'll begin consecutive visits on September 16.
15:40
@davidism yeah, they call it the "poor man's gold"
@davidism setting as home page is not cheating
I already lost it once when I went on vacation, and almost lost it again when I was moving a week ago
@davidism same here
that is why on
I lost it twice
15:41
vacation even if abroad, you get a prepaid sim and have it as homepage :P
i got my fanatic on vacation :D
the thing is it requires concentration
I'll either get steward or electorate next
Fanatic isn't that hard... I've got errr, 631 days consecutive now :(
:D:D
17 consecutive
@davidism there are many stewards
yall should see the review queue of the rarer ones even now
CV and Edit are the only feasible ones at this point, I can't imagine being persistent/fast enough for the others
lq is also doable
just get your 20 done
15:47
@davidism you're valuable to us regardless of whatever badges you have :p
the others are theoretical :D
yes, but I could always be more valuable by gold content :P
I can't imagine doing review queues. I always skip like 99% of the posts.
filters are your friend :) uncheck duplicates, set python tag
15:51
too bad there's no gold badge for
> I am too lazy to even research this myself, what's the language that I can be the laziest in to make a web app?
@davidism well... you're probably just under half way to a Python gold badge :)
Give us a D, give us an A, give us a V, give us an I, give us as a D.... and what do you have....! Cabbage!
3
oh wait - don't think that's right
I'm close to silver. 308/400.
I think Steward will be my next one.
@Ffisegydd slacker :)

« first day (1388 days earlier)      last day (3786 days later) »