« first day (2460 days earlier)      last day (2475 days later) » 
00:00 - 16:0016:00 - 23:00

stt
12:51 AM
hi, any ideas what's wrong with this pyparsing code?
OneOrMore( nestedExpr(content=~Literal(')') + ~StringEnd() + restOfLine) )
it's for this simple lisp inspired syntax, it goes into a loop looking for something. and messed up thing is it works in this one ipython session, but not in another one %|
 
@stt - perfect timing, I just got back from dinner
 
stt
hi Paul! :)
 
Do you also need a negative lookahead for '('?
and restOfLine will be quite greedy - once you get past the initial "not ')' and not StringEnd", restOfLine may suck up a whole bunch of nested parenthetical phrases
 
stt
at the moment I'm just trying to get contents of (something abc) (another zxc) statements read to a list somehow
tried adding the lookahead for (, no change .. it's like I'm taking crazy pills.. even pickled that OneOrMany parser from the first ipython to a file, read it in to the second ipython and verified that then it parses just fine
 
For something that simple, use content=Word(alphas) or Word(alphas, alphanums)
Weird - different pyparsing versions between the two?
Not that any of those classes have changed recently
 
stt
1:01 AM
nope, just installed, 2.2.0 on both, py3.6
syntax requires recursive nestedExprs
did play around with ParserElement.setDefaultWhitespaceChars but set it back to default
 
Yes well recursion can be done with nestedExprs, but the parsed contents are not always the best. - I'm going to open a separate chat for this work.
Go to the chat room I just opened
 
 
6 hours later…
6:39 AM
cbg
 
7:33 AM
cbg-ning
 
7:51 AM
question:
Let's say I have this kind of list
big_list = [['abc','tomato','candy crush'],['iOS','Berlin','Tianjin square']]
I want to put them into columns for each list
I did this code
for value in big_list:
    for value1 in value:
        print(value1)
but alas it gives me this
abc
tomato
candy crush
iOS
Berlin
Tianjin square
what should I do to have this?
abc               iOS
tomato            Berlin
candy crush       Tianjin square
wait I may have the answer to my question
thanks guys
 
user1118051
morning guys
 
user1118051
any ideas how to sort this dict by a certain value of my choosing?
 
user1118051
{'1stFlrSF': {'uniqueKey': 35, 'unique_values': 753},
 '2ndFlrSF': {'uniqueKey': 36, 'unique_values': 417},
 '3SsnPorch': {'uniqueKey': 55, 'unique_values': 20},
 'BedroomAbvGr': {'uniqueKey': 43, 'unique_values': 8},
 'BldgType': {'uniqueKey': 14, 'unique_values': 5},
 'BsmtFinSF1': {'uniqueKey': 27, 'unique_values': 637},
 'BsmtFinSF2': {'uniqueKey': 28, 'unique_values': 144},
 'BsmtFullBath': {'uniqueKey': 39, 'unique_values': 4},
 'BsmtHalfBath': {'uniqueKey': 40, 'unique_values': 3},
 'BsmtUnfSF': {'uniqueKey': 29, 'unique_values': 780},
 
user1118051
also would this be a correct way to store data?
 
user1118051
or this is better? {'column': '1stFlrSF', 'uniqueKey': 35, 'unique_values': 753}
 
8:34 AM
i have a pandas df column with flat and NaN. How do I convert it to int
astype wont convert NaN to int
 
How does that work? How do you convert not-a-number to number?
Can't you just propagate NaN onto the integer type?
 
@RomanLuštrik stackoverflow.com/questions/11548005/… I just need my columns to be without decimal (NaN can remain NaN) I need to compare these vaule which are int equivalents
 
Morning...
 
9:00 AM
how to i find rows that have both BuyAccountNo and SellAccountNo not null I tried ` df2[!(df2['BuyAccountNo'].isnull()) and !(df2['SellAccountNo'].isnull())`
it is a pandas dataframe
 
@Withnail \o
 
I also tried ` df2[!df2['BuyAccountNo'].isnull & !df2['SellAccountNo'].isnull() ]`
 
user5969682
9:16 AM
Do mod_wsgi version and the python it'll use has to be match? i want mod_wsgi that uses python in /root/anaconda3/bin/python
 
user5969682
I am trying to reinstall my server from scratch. this time i'll be carefull. i want that my flask app uses the python in /root/anaconda3/bin/python and it is somewhat related in mod_wsgi. i have been trying to set this for 3 days and i am aware of SO questions.
 
cbg guys!!
 
@user1993 hey Sunshine smile
 
:)
why does this open not work -
rule_f=open(os.path.join(os.path.sep, 'E','F DRIVE',rulefile,'.txt'),'w', encoding="utf8")
gives the FileNotFoundError error. Why does it not understand that it's a file create command?
 
9:36 AM
@user1993 What is the output of os.path.join(os.path.sep, 'E','F DRIVE',rulefile,'.txt')?
Your path is likely incorrect, check stackoverflow.com/a/32024489/2689986
 
the output with the full address (i gave only partial here) is \E\F DRIVE\drive\M.Tech\for assigning cl\newer_improved_rules\56\.txt
with rulefile=56
@AshishNitinPatil is it wrong that the path starts with a '\' or could the problem be that I am trying to name the new file with just a numeric-kind name (although i string'ed it)
oh! I realized it's the .txt which is being appended at the end of the path incorrectly. Trying to think a good way to add the file extension properly....
found it - ....,rulefile+'.txt'. was quite simple!
thanks for being my rubber duck :)
nope, still gives the same FileNotFoundError error!
 
cbg all... I forgot my headphones at home today :'(
 
9:52 AM
finally went back to
path2 = r'E:\F DRIVE\drive\M.Tech\for assigning cl\newer_improved_rules\\' +rulefile+ r'.txt'
rulef=open(path2,'w', encoding="utf8")
 
10:16 AM
@user1993 yeah, Windows paths should be like E:\somedir\otherdir\filename.ext, your original code was missing the colon : and was starting with \. And yep, always better to work out the big string before feeding it elsewhere, like you've already done in the latest solution.
Ah, nasty formatting. Can't get backslash to be bold.
 
10:35 AM
ah! thanks
 
@user1993 are you aware you are using a double slash in a raw string?
 
@WhatsThePoint yes. Putting just a single slash makes the following inverted comma part of the string
 
mongo's java client is awful
 
@user1993 ah your using single quotes for your strings, i see, i usually use double quotes in mine
 
using double quotes seems to be no different!
@WhatsThePoint
 
10:52 AM
@user1993 yam slashes always messing everything up
 
@user1993 dude you've put the file name and file ending as other parts of the path
try
rule_f=open(os.path.join(os.path.sep, 'E','F DRIVE',rulefile + '.txt'),'w', encoding="utf8")
@user1993 oh whoops you had seen this sorry
@user1993 you should put w+ as the open mode if you want to create a new file
I think that's the issue, not the path
try with w+ using the os.path.join approach again
 
nope. the following does not work either -
rulefile=str(56)
path1 = os.path.join(os.path.sep, 'E','F DRIVE','M.Tech',rulefile+'.txt')
rulef=open(path1,'w+', encoding="utf8")
rulef.write('something')
rulef.close()
gives FileNotFoundError
 
11:07 AM
@user1993 Can you give me the output of os.path.exists(r'E:\F Drive\M. Tech')?
And path1 = os.path.join(os.path.sep, 'E','F DRIVE','M.Tech',rulefile+'.txt') is quite wrong like I mentioned previously.
 
yes. It's false
@AshishNitinPatil so how to use os.path.sep in this case? It seems to be quite recommended
 
So, as I had mentioned, via this link - https://stackoverflow.com/a/32024489/2689986
You need to have the directory already created, else you can't create new file inside a non-existing one.
 
no no! The path here was dummy. for the real path, the output of exists is True
 
@user1993 You are already using os.path.join which internally uses os.path.sep to concatenate the path(s) given to it.
 
11:11 AM
So, it should just be os.path.join('E', 'F DRIVE', 'M.Tech', rulefile+'.txt')
 
surely the path does not exist, try something like this - stackoverflow.com/a/12517490/8131703
 
@user1993 That works on a UNIX system! You are using Windows. UNIX paths start with /, Windows paths don't.
 
oops
i thought this method was designed to be OS independent
so that we dont put any slashes
@AshishNitinPatil funnily, this doesn't work either -
rulefile=str(56)
path1 = os.path.join('E','F DRIVE','drive','M.Tech','for assigning cl','newer_improved_rules',rulefile+'.txt')
rulef=open(path1,'w', encoding="utf8")
rulef.write('something')
rulef.close()
 
@user1993 If by this method you mean os.path.join, then yes.
 
and there is a path E:\F DRIVE\drive\M.Tech\for assigning cl\newer_improved_rules in my system
what's going wrong ?
 
11:17 AM
@user1993 try path1 = os.path.join('E:',os.path.sep,'F DRIVE','drive','M.Tech','for assigning cl','newer_improved_rules',rulefile+'.txt')
 
@LangeHaare THAT WORKED
 
You need to create a directory first, if it doesn't exist. Then you need to be very sure of the path.
 
:D finally! sorry for all the bad advice I gave before, I don't know what I'm talking about
 
oh, so I need to put the os.path.sep after the E:!
that's strange!
 
OMG, no.
If that worked, this should work too

path1 = os.path.join('E:', 'F DRIVE','drive', 'M.Tech', 'for assigning cl', 'newer_improved_rules', rulefile+'.txt')
 
11:21 AM
i just tried that myself, it doesn't!
 
@LangeHaare that's it!
 
at least we got there in the end! I'm gonna get some lunch
 
thanks!
 
Glad you worked it out, but I would NOT recommend using os.path.join in Windows when you already have most of the path already known.
 
11:27 AM
is that right?
 
For example, you already knew the file path in question, it was just missing file name.
 
yes
 
You should use os.path.join when multiple things are being joined via code, i.e. you may have multiple level directories that you don't know before hand (variables).
 
oh! OK
 
In this case, a simple str.format would have worked. And it wouldn't have given you so much headache.
 
11:30 AM
ya, just that this method is so widespread that I wanted to try it
 
path = r'E:\F DRIVE\drive\M.Tech\for assigning cl\newer_improved_rules\%s.txt' % rulefile
 
this makes so much more sense
 
@user1993 It is indeed a recommended method when you have multiple variables and want your code to be OS independent.
But your case is quite simple, and it won't work on any other machine than yours (hard path, specific to your machine). So, you should keep it simple :)
 
yes, thanks. Will make the change
 
And like I had mentioned, os.path.join internally uses os.path.sep to join / concatenate the strings given to it. If a path already ends with the separator, it wouldn't add it.
Only a few days back I was laughing at the newbies here over code formatting, and today I also got stuck with it. Need to follow Kevin's godly guide.
Guide only states it can't be done. So, I wasn't doing it all that wrong, but was just highly expecting it to work. Web dev is hard.
 
11:38 AM
ya, it's pretty good!
 
cbg
 
best part is explicitly stating all the things that can't be done
 
11:52 AM
cbg
Can you encrypt a .txt file and will python be able to read it?
Can you even encrypt .txt files?
 
python is turing complete, you can do everything™
txt files are data like everything else. there's nothing preventing you from encrypting them
 
Cool I don't completely know if I need to do that
Hey check this out I thought I would make a Trello so you lot could see what I am trying to do with my python project
If you want
You don't have to look at it but I thought it might help when I ask you questions
rbrb
 
12:22 PM
@AshishNitinPatil Also look into using pathlib module in the std lib
In[2]: import pathlib
In[3]: dd = pathlib.Path("/users/paulmcg/z")
In[10]: dd.mkdir()
In[11]: my_file = dd / 'rules.txt'
In[13]: my_file.write_text("Don't talk to strangers")
Out[13]: 23
In[14]: print(my_file.read_text())
Don't talk to strangers
In[15]: str(dd), str(my_file)
Out[15]: ('/users/paulmcg/z', '/users/paulmcg/z/rules.txt')
 
@PaulMcG yeah, I am aware of it (love the Python 3 Paths), but I didn't want to complicate things when the simplest stuff was getting misunderstood.
 
@PaulMcG whooooah so that's why they say it's magic!
 
12:41 PM
API Design 101: "Make the common stuff easy, and the uncommon stuff possible." So simple to add __div__ method to build up paths using the '/' operator.
 
yeah, I figured that, but the idea and its use is magic
and a good kind of magic
 
is there a data structure that can efficiently access elements based on an index (like a list), and efficiently insert/delete elements (based on a different index/key)?
 
I saw an open-source scientific python program where << was redefined to mean a kind of mutating assignment
as in for params in all_params: data << params
not confusing the least bit
(pun unintended)
 
Cabbage
 
cbg
@Rawing dict?
or do you want it to be slicable?
 
12:44 PM
Any one has idea on how to remove the 'Sqlite_sequence' table from sqlite DB? Its not letting me drop the table..
 
without knowing any sql I suspect that there's more to it than "not letting me drop the table"
 
I don't need to slice it, no. Not sure how I'd use a dict for that though.
let me give a less abstract problem statement
 
I was trying to migrate new changes in my DB using flask_migrate and since my model does not have the sqllite_sequence table the migrations are not working
 
@Rawing OK, I'm probably missing your point
 
@AndrasDeak The error is "table may not be dropped"
 
12:46 PM
@Anarach ah, so is that a built-in table or something?
 
@AndrasDeak Yeah Built in table
 
I see, thanks
 
Not letting me apply migrations since the model does not have this table and the flask_migrate engine is trying to drop this built in table to match my model
 
can't you create it then?
there are a lot of posts about these tables such as this one, but google is all I can add to the subject
 
Umm... Yeah I can but I was wondering Do i have tooo!
 
12:48 PM
I see
 
Thanks Anyways.. No time to fool Around :-D
 
so your question is not "how to remove the sqlite_sequence table?", but rather "how can I tell flask_migrate not to look for this table?"?
 
I have a list. I want to be able to sort and filter this list. So whenever an element is inserted or deleted from the list, it needs to be inserted/removed from the filtered&sorted version of the list as well.
 
@AndrasDeak Yeah actually!
:-D
 
@Anarach OK then ;)
@Rawing is there a reason why you're not keeping track of only the sorted version?
 
12:55 PM
morning everone
 
morning
 
@AndrasDeak Well, I'd like to preserve the original order if no sort function is set. But it wouldn't be a big deal to always require a sort function I guess.
 
you could use a dict and keep track of the sorted order (?)
that sounds weird too, but so do your requirements
hmm, maybe not
perhaps you can actually use two lists, and append/remove from one, but insert-like-insertion-sort for the other
 
I mean, what about using the identity function as a default sort function?
 
yeah, sorry about that. I've been thinking about this for so long that I've even confused myself. Been thinking of too many different possibilities, so it's hard to remember what I really need.
 
1:00 PM
at this point I should note that I have no idea about the scaling of various costs
@Rawing you should try to get back to your X in XY then ;)
 
If the list is [8, 4, 8, 15] and the sorted list is [4, 8, 8, 15], and the user deletes the second 8, which 8 should be deleted from the original list?
 
That way you always have something to "sort" with, but you don't change the order unless the user specifies a function.
 
Does the answer change if the sorted list is descending, [15, 8, 8, 4]?
 
@Rawing Is heapq what you are looking for, perhaps?
 
@MorganThrapp I think the idea is to prevent sorting all the time?
@PaulMcG I knew the idea rang a bell...
 
1:02 PM
@AndrasDeak Ah, gotcha. That makes sense.
 
@Kevin In that case I don't care if the behaviour is undefined. If the sort function returns 8 for two different elements, that's not my problem. Just delete either one.
 
ok
When something is inserted into the sorted list, where does it go on the original list? The end?
 
that's how I understood it
there's one list which is built by appending and deleting, and another list which is always the current filtered&sorted list
and Rawing wants the latter to be something more efficient than sorted(filter(fun,current_state_of_list))
 
You aren't supposed to be able to modify the sorted list. All operations are done on the original list only.
Hmm, I think I can work with heapq. Thanks for the suggestion @PaulMcG. I'll report back on my success/failure
 
My half-formed concept is to pair each item of the sorted list with the index that element has in the original list
Creating and reading and updating are fairly straightforward but deleting requires an O(N) loop through the list to decrement every index larger than the index of the element you're deleting
 
1:12 PM
What is wrong with this SQL Querry?
ALTER TABLE memberdata ALTER COLUMN email DROP NOT NULL;
 
But IIRC del is already O(N) for lists, so you're not introducing more big O complexity, you're just increasing the constant multiplier
 
Says Syntax error near ALTER:
 

SQL

Got a SQL question? Any SQL flavor here, just ask. Indicate yo...
 
Its a very basic query so asked here..
 
I don't expect to have very many delete operations. The primary use is going to be random access, and insertions. What can happen however, is that the entire list is cleared, so I just have to find a way to handle that.
 
1:15 PM
If it were complex i would obviously go there
 
@Anarach Are you saying you'd be equally likely to ask a basic Python question in the SQL room? That's not how that works.
 
@davidism Hmm Makes sense, Didnt think of it that way
 
\o cbg
 
Just lost 48 rep from "user was removed", that's the largest chunk I've lost yet.
 
1:29 PM
@davidism does that mean someone who upvoted you deleted their account so you lost the rep from their votes?
 
Either they deleted it or they got deleted, but yes.
I get occasional weird groups of upvotes, I assume the type of user who does that also doesn't understand how other parts of the site works and gets in trouble eventually.
 
@Rawing proof of concept pastebin.com/mKuLisis. (based on all the requirements gathered up to the last question I asked. clearing the entire list is left as an exercise to the reader)
Tangentially related: "delete" and "create" are words. "deletion" and "creation" are words. "update" is a word. "updation" should therefore be a word.
 
@davidism it could've been a series of unrelated upvotes by the same user
then again there were events in the past where the deletion of elaborate sock puppet accounts led to several hundreds of rep being lost as collateral damage
 
1:45 PM
This is an exact copy of this question posted 10 hours ago by a different user. Do not re-post questions. — davidism 9 secs ago
Can't close as dupe, since they're different users with no upvoted answer on the older one.
Way to reveal your second account though.
 
flag flag flag
 
Yeah, I submitted a mod flag.
 
oh, and non-trivial sock accounts, nice
 
Weird bug
It showed that I used the python hammer to close it
 
I think that's documented on meta
 
1:48 PM
Nah, it should just show the mod diamond and not the python gold badge.
 
"I couldn't have duped without a diamond" is pretty much an edge case
it's still a python dupe :P
 
@Kevin That looks promising, but unfortunately it's backwards. You're doing all operations based on the index in the sorted list, not the index in the original list. I don't see an efficient way of turning an original-list-index into a sorted-list-index
 
@Rawing inverting permutations like this is easy (unless I'm missing something obvious which is likely because lunch time)
 
@BhargavRao lol, the separate users each deleted their post within seconds of each other.
 
hehehe
nuke in 5...4...3...
 
1:50 PM
Yeah I was operating under the assumption that the user can't see the original list, and probably doesn't even know it exists, and only performs operations in relation to the sorted and filtered elements that he can see.
If there are four elements on the page and the user clicks the "DELETE" button next to the third, there's no indication on the GUI that the third element on the page is actually the 76th element in the original list, or whatever. Or at least that's how I imagined it
 
That's a good point. Looks like I need it to be efficient both ways. Or maybe I should just discourage making modifications to the original. Hmmm.
Thanks for the help, I'll figure something out. Once my headache goes away, that is.
 
too much drinking last night, eh?
 
it's not my fault; you guys tempted me D:
 
otherwise it's likely the same insane weather front we've been having around
unless you're somewhere in the west
 
> Dew Point 70 °F
no wonder my bike ride in felt like it was a miserable experience
 
2:01 PM
No, that was just the physical activity itself.
I go up a flight of stairs and already feel miserable ;)
 
I'm standing at my desk in the AC 15 min later and still sweating profusely :(
 
DSM
Tuesday morning cabbage for all.
So a morning meeting has been postponed by half an hour, which is an inconvenient unit of time for me. Never sure what fits into that small a chunk of time.
 
Cabbage DSM \o
 
@DSM SO obviously
 
It's not SO obvious :-p
 
2:13 PM
hmm I'm mildly concerned that a chat room of calm professionals has thought it fit to star the message of mine describing most serial killers as calm professionals :o
 
DSM
The python is not an entirely peaceful creature.
 
Add to the fact that the default python setup comes with a REPL
sad pun, again.
print('Goodbye world!')
 
@AshishNitinPatil REPL <-> "reptile"?
 
2:30 PM
TEST
ok hi
 
o/ all
 
\o cbg bud
 
\o/ hello!
 
cbg, idjaw
 
cbg
 
2:43 PM
wall of cbg
 
cbg
 
user3657941
Need help re-opening a question
 
[tag:reopen-pls] {link to question} {reason for reopen}
 
user3657941
 
so close
 
user3657941
2:47 PM
I voted to close this, but after looking more closely at the answers in the linked question, I realized they they recommended downloading binaries for a different version of Python. One link is to a file in a DropBox account. I don't think it's a good idea to recommend that someone download a binary version of a cryptography library, so I think we should re-open this.
 
user3657941
Yes, the error messages are also different because those were the error message that occurred at that time. Apparently, the pycrypto installer has improved its error messaging.
 
Well, it's reopened. But I probably shouldn't have. You should have answered the more canonical question with a better answer.
 
user3657941
I guess I didn't consider it canonical due to the error message difference. The only canonical part is the title.
 
user3657941
But thanks
 
user3657941
Actually, unless the title is changed to the new error message, I'm not sure I would consider it canonical
 
user3657941
2:51 PM
This whole thing of pycrypto getting buried like a bomb for people trying to install packages on Windows is inconvenient.
 
user3657941
A lot of people seem to get nervous when they see a message asking them to install a compiler.
 
user3657941
And that happens for other packages besides pycrypto. So I guess the canonical answer would be How to install a Windows compiler when pip complains?
 
user3657941
If I had the power, I would modify pip to present a prompt asking the user if they want to download a compiler on Windows.
 
user3657941
I can also imagine a question Why do I need to install a compiler to install a pip package?
 
woosh...there are a lot of words happening
is there a TL;DR;?
 
2:59 PM
tl:dr pip doesn't prompt people to install a compiler for certain packages and David wants change; all triggered by some question posted
 
user3657941
TL;DR? Sometimes installing a package via pip on Windows installs a dependent package that requires manually installing Microsoft Visual C++.
 
so what are you up to this Tuesday ?
 
@DavidCullen does this say good things or bad about python? On the one hand, it enables people who are scared of compilers to do a bit of programming - on the other hand, does it hold people back by not asking them to take the training wheels off?
 
codin', reviewin', musickin'......that's about it
 
so livin'... got it
 
user3657941
3:01 PM
@LangeHaare: I think using pip on Windows can be hard for some folks because installing a compiler isn't something a lot of people do on a regular basis.
 
Listening to the new Jay-Z album. Pretty damn good.
 
user3657941
@LangeHaare: And I would say this is about pip, not Python itself
 
user3657941
@LangeHaare: I have installed Python on Windows and have been able to do lot of useful things without ever having to install a third party library.
 
@DavidCullen really I'm responding to when you said A lot of people [i.e. python-users] seem to get nervous when they see a message asking them to install a compiler. - that wouldn't be true of many people doing useful things with C
 
@idjaw he still create music? I thought he might have retired or something...
 
3:05 PM
nope. He's still making music and doing very well at it and I'm going to see his show in November too.
 
user3657941
@LangeHaare: So I think what happens is that a lot of beginner programmers install Python on Windows and get a lot done with it. Then at some point, they find out they need to install a third party library. So they figure out how to use pip, because that is what everyone recommends. Then pip tells them they need to install Microsoft Visual C++. At that point, they seem to get nervous.
 
user3657941
@LangeHaare: They may not understand that many third party packages depend on other packages and these other packages have to be compiled from source. I would prefer to place the blame on pip, because until the user runs pip, they don't have a problem.
 
the same issue is on linux ;) my previous manager was always struggling with Python.h does not exist ;) he never remember what to do
ofc googling was too hard for him
 
user3657941
@marxin: On Ubuntu, it seems like I can't get anything useful accomplished without installing build-essential, so I've already figured out how to install the compiler by the time pip gets run. And then when it complains about Python.h, I remember I have to install libpython-dev (or whatever).
 
3:15 PM
@marxin but if people learn to google, I'm pretty sure a lot of IT related jobs would be lost :(
 
user3657941
I'm going to make a guess and say that if someone is doing something with Python on Ubuntu, they've already resigned themselves to seeing error messages that require some Google Fu
 
@idjaw actually google discourage people to use this term :D
 
Too bad for them. I'm gonna use it even more now.
#rebel
 
user3657941
Why does Google care? I'm trying to imagine a good reason, but maybe I should just do some googling?
 
yeah, I think if we start googling to find out why google wants to stop us from using googling, we might find a valid reason to stop using the term googling
 
user3657941
3:18 PM
Google to the rescue: "And becoming generic is bad because it threatens a company's legal right to a trademark."
 
user3657941
TL;DR: Money
 
user3657941
Google doesn't want to be Kleenex
 
I saw an ad for 'ok google [submit task like turning on lights or what not]' and my first thought was, so it begins, Google is slowly taking over the world in more of a public/private sense.... (not that they don't have absolute power already)
 
@DavidCullen has kleenex lost their right to a trademark?
 
it has pros and cons, but I guess because google is already well known anyway, they see more cons
 
user3657941
3:21 PM
If this were 30 years ago, and someone was making a movie about a person talking to their computer, and they had picked a silly name like Google for the computer, everyone would laugh when they talked to the computer. Just replace "computer" with "Google" in a Star Trek the Next Generation episode
 
user3657941
"Google, what are the consequences of reversing the polarity of the warp coils while traveling at warp 9?" Cue laugh track
4
 
user3657941
Wow. Sorry to go off on a tangent.
 
sounds like Queeg from that one episode of Red Dwarf
 
Amazon has this feature they are rolling out, <insert the female name for the robot, I forget the name> and it asks you to take a picture/video of yourself and it rates your outfit based on the current trends and what you are trying to achieve...
 
hey guys, I'm trying to use a python script to kick off another python script that will run in the background, and then after kicking off, exit the calling script.
I've tried using subprocess to no avail
any quick ideas?
 
3:25 PM
What did you try? What happen? what error did you get? When you say exit the calling script, do you mean it doesn't wait around for the child process to finish ?
 
subprocess with shell=True? really quick, I don't know if that helps
 
is there any particular reason for closing the parent script?
 
I think the parent script is just a drop-in for a bash script that runs the other one
 
user3657941
On Unix: nohup script_name.py >> /dev/null 2>&1 &
 
as if the child script was a deamon or something
 
3:26 PM
too many unknowns :( going to give up on guessing now. On another note \o cbg Andras
 
cbg
I've been here but got a bit distracted by some fish fingers
 
@DavidCullen I would use nohup and then &, the reason I want to launch from another python script is that the ampersand doesn't play nice with ansible for some reason
@MooingRawr this was my solution (that doesn't work, the script waits for the subprocess to finish and then exits)
 
@Jfach why cmd.kill?
 
I'm not sure, I was under the assumption that if i didn't do cmd.kill that the process would stay open?
sounds a bit silly
 
user3657941
3:31 PM
@Jfach: You can still use nohup in a subprocess in Python. It just means that when your parent script exits, it won't kill the script that was started with nohup.
 
feels like you're doing something incorrectly
i mean not python but in general ;)
 
@DavidCullen yeah, thats exactly what I need, but I can't seem to get the parent script to exit
 
@Jfach isn't "the process would stay open" exactly what you need?
 
after starting the subprocess thread, I tried to call sys.exit(), but it won't exit, although print statements after starting the thread are executed
@AndrasDeak correct, that part is not really a problem then I guess
I really just need to be able to do python parent.py, which will kick off python child.py and run it in the background, and then exit while child will still run
 
import subprocess

subprocess.run(['bash','-c','sleep 3; echo DONE.'],shell=True)
if you run this ^ in python, it will exit python then display the DONE a few seconds later
 
3:37 PM
do you need shell=True there?
 
@idjaw yes
that's one of the key components
otherwise the parent process and the subprocess share a shell
so the parent has to wait for the kiddo
 
oh ok!
 
@AndrasDeak ahhh
 
actually, it won't display the "DONE". But python exits anyway
I could change it to a touch call and see if the file is created; I suspect yes
OK my assessment may have been incorrect :D
sorry, let me see this
bah gotta leave now
 
yes I just confirmed that
 
3:43 PM
I'll come back to this later
 
import subprocess
subprocess.run(['a.py'],shell=True)
where a.py writes a file. it works out or am i missing something
 
I actually got it working, I can post my solution if you are interested
 
@MooingRawr the question is whether the child process can run after the parent has finished
put a time.sleep(10) inside your script and see if it still works
 
in child right ?
one sec
 
@Jfach yeah, please post the pastebin, I'll read it later :)
@MooingRawr yup
rhubarb for now
 
3:48 PM
import subprocess
subprocess.Popen(['a.py'], shell=True,
             stdin=None, stdout=None, stderr=None, close_fds=True)
Child process has a 10 second delay and still runs, parents quits right after the spawning - that sounded cruel :(
 
this was my solution in case y'all were curious: pastebin.com/GQ0eJA4j
 
well at least you got a solution :D
 
00:00 - 16:0016:00 - 23:00

« first day (2460 days earlier)      last day (2475 days later) »