« first day (1288 days earlier)      last day (3677 days later) » 
05:00 - 19:0019:00 - 00:00

7:18 PM
how do people program python on windows? I don't get it... do you need a cygwin terminal or something?
 
?
No..
It's basically an interpreter(?) written in tkinter
Type what you want, hit F5 or run it some other way
Then it opens in the terminal and runs
 
I mean like, if you want to pip install something
 
PowerShell
 
pip is already included in 3.4
 
It's basically a bash shell for Windows
And it's got the word POWER in it so it must be good.
 
7:20 PM
@Crow http://www.lfd.uci.edu/~gohlke/pythonlibs/
If you are using anything below Python3.4, check this site out, many unofficial binaries for Windows.
Including pip
Oh I see they added 3.4 binaries as well
 
cool cool. I'm thinking of doing small tutorials on youtube for python and web development, but I feel like I am not experienced enough yet...
 
One of the best ways to learn is to try to teach.
 
I'd watch 'em... you could do an awesome one on dict's by now
 
I frequently make ipython notebooks as little tutorials on different subjects. I've never actually given them out to anyone, but it's a good way for me to get my thoughts together.
 
@Ffisegydd That's very true. I have studied metaclasses and decorators very very deeply when I had to give a Python overview lecture at work.
 
7:26 PM
Plus it also means if I ever need to refer to them I know I have them.
 
that's a big reason I want to do it, plus flask is well documented so most of it is probably reading through docs.
 
It might be Crow that you don't end up publishing the first drafts online, but it'll definitely help you pull everything together.
And if you do get some nice tutorials together (written at least) you could whack them on sopython.com/wiki maybe
 
@terfin while true - I do think meta stuff and the inner workings of Python aren't essential to start with
 
@JonClements Oh, I wasn't starting with it, actually it was a C# vs Python lecture, mostly about differences, I only mentioned metaprogramming in general. I still had to do the research tho.. just in case
 
I've hammered the rep today :o hadn't even realised I'm nearly at cap.
 
7:30 PM
I'm a little concerned about two things in my first video, but they're both just python based. In the flask documentation, it says to make the app like this: app = Flask(__name__). What is the significance of __name__? I know it has something to do with imports and the calling of the application
 
@terfin that makes sense ;-)
Beautiful thing about Python is not having to understand how it works - it just does
@crow it's the name of the module you're in
 
I wonder if they ever ask me to give a Python course.. it started to be rather trendish, courses about other languages. The main programming language we use is C#, on Wednesday I am going to hear the first lecture out of a rather large set of lectures about Java.
A ruby lecture is only a matter of time, since one of the most senior and leading consultants is a heavy rubist. Since I am the only one who knows Python in the entire company....
 
@JonClements so like... is it so if I import my app in another file, the app in that file will now have a different __name__?
 
Every module has a unique value for __name__
 
@Crow ^
 
7:34 PM
Cbg @poke
Started to move sopython (as in installled nginx and uwgi)
 
Seriously guys, can you have a look at this question(not asking to answer it). Does it look like I'm hiding code?!
 
@poke what implications does that have for the initialization of a Flask class?
 
None
 
in that case, can I give it any name? Why do they recommend using __name__? They seem to say it is about importing.
 
And that would have been the router I just unplugged... smart Jon, very smart
 
7:39 PM
You can’t change __name__.
 
@poke you can - but not recommended :-D
 
oh okay. I dunno, reading this it looks like they're saying use __name__ if it is not a module, and hardcode a name if it is not.
 
If you're using flask normally - just go with it and don't over think it ;-)
You don't need to understand every single thing (nuance) at once
 
Crow if you're going to be doing tutorials for beginners you won't need this level of detail.
Just tell em to use __name__ and warn them if they don't you'll hit them with a rolled up newspaper.
 
sure, I just want a short answer as to why that name is considered important. Seems likely to be a question a beginner would ask.
 
7:45 PM
Ahhhhh
 
@ffisegydd like you do to me hey... hit the poor puppy with a newspaper... woe is me, woe is me... :-D
 
You shouldn't not use __name__ should you!?
 
@crow you're doing courses?
 
@hanleyhansen which courses? I am just reading through their documentation
 
oh nevermind. i misread lol
 
7:48 PM
@crow you do realise __name__ is explained in its docs?
 
yes, I am reading that right now. flask.pocoo.org/docs/api/#flask.Flask I just don't get this line: "If you are using a single module, name is always the correct value."
oh I see... because modules look like blah.dir.stuff, so splitting on . would get it to blah, which is the import path... makes sense.
 
@poke if I move the site and database - you happy to move the git stuff?
 
I planned to do things tomorrow..
 
Okies... well I can hold off...
 
 
1 hour later…
9:15 PM
Really nice steak
 
Having trouble using CX_freeze
Trying to compile a script that uses Kivy modules, but of course those aren't inside my Python build, so It's unable to build it with them.
I'm not sure what to do. I can either try and install cx_freeze inside my Kivy python build, or somehow move the required Kivy modules over. But I don't know how to do either.
 
@Owatch can't advise on either... no experience in that I'm afraid
 
Sigh, do you know if its possible to move modules over?
Kivy is written in Python AFAIK. So it's another Python build just with the added components for Kivy. I had it installed separate of my main Python33 install just to avoid any mishaps.
I don't know how modules much, so I don't know if saying "copying over modules" is even logical. But I was hoping someone might know.
Sigh, it seems I'm the first to do this.
(Googled a little)
 
good luck with it, I'm afraid I don't have time to assist
 
cool.
 
9:21 PM
I very much doubt you're the first person to try to cx_freeze with Kivy
 
With the py3 version?
 
@Ffisegydd still up ? :p
 
Maybe not, but I couldn't find anything where someone using Python3.3 with the 3.3 version of Kivy was trying to use cx_Freeze to create an .exe
 
@Jon I could say the same to you puppy :P I'm still messing around with pandas/SO API
 
bleeeh my program is breaking and it's due tomorrow :\
 
9:25 PM
People using Kivy with 2.x can use other installers, but using 3.3 really limits the options.
 
Jeeze... don't even remember answering this one
 
It doesn't matter. You're probably right
 
@Ffisegydd was at a nice restaurant on a date... :)
 
we won't be meeting again - I hope
but food was fanastic
 
9:33 PM
Why are py to exe scripts and software taking so long in supporting Python 3
Python 3 first came out in 2008, apparently
It's been a while...
 
Transferring software languages can take a lot of work, and until Python 3 takes off there's no point in them doing it
 
You like Stewie it seems
Not only your profile thumbnail, but your links too.
 
Stewie could be his role model
 
everyone loves Stewie :)
welcome to the room @user1653150
 
is there a way to see where a method was called by line number?
 
9:47 PM
Hi, I have a problem with my code, I try to read from a file and write results into another file, but it only write the first 350 lines out of 35734 lines, does any one have an idea why this happens, please?
 
@user1653150 you will need to provide some code or something to help us help you with.
 
l1=[]  ## empty list
l2=[]  ## empty list

csv_file=open('dates_read.csv', 'r+')
csv_wfile=open('dates_write.csv', 'w+')

csv_read = csv.reader(csv_file)
csv_read1 = csv_read
csv_write = csv.writer(csv_wfile)
for row in csv_read:
    s=csv_read.line_num
    if (row[4]=="start" and (s not in l1)):
        n1=datetime.datetime.strptime(row[2], '%H:%M:%S')

        l1.append(s)
        month = str(row[0])
        day = int(row[1])
        time = str(row[2])
        year = int(row[3])
        user = str(row[5])
 
@Crow maybe you could throw an exception and follow the stack trace?
 
it was not formatted right the first time
 
@ZachR nah, getting an infinite loop. It's not actually failing execution
 
9:51 PM
1 message moved to Trash can
 
can someone help me with extracting floats from strings
i get the following result
[u'2.6']
 
@user2962786 that is a list with one element inside it, that element is a unicode string. What's your problem?
 
i use print re.findall(r"[-+]?\d*\.\d+|\d+", results)
its extracting from html text and the result was
[u'2.6']. How do I remove the u
 
It's a unicode string, the u is there to signify this fact.
Do you want to convert it to a float?
 
yes exactly
 
9:54 PM
Will it only ever be one number or could it possibly be multiple? Such as [u'2.6', u'3.8']?
 
I'm reading the file line by line and then finding the difference in time and then write the result into a new file, the problem is that it only write the first 350 lines out of 35734 lines @Ffisegydd
 
it should only be one
 
result_str = re.findall(r"[-+]?\d*\.\d+|\d+", results)
result = float(result_str[0])
That will take the 0th (first) element of your list and then convert it to a float.
 
Hello to everyone! I have a problem with this line:
STATICFILES_DIRS = [os.path.join(os.path.dirname(__file__),'static').replace('\\','/')]

this get error:
TypeError: coercing to Unicode: need string or buffer, list found

What I is wrong in this line?
 
@Ffisegydd thank you
 
10:00 PM
STATICFILES_DIRS there is a list, not a string, as you've surrounded it in []
And why do you replace \\ with /? There isn't actually any double \\s, it's just Python has to slash-escape them.
 
I'm reading the file line by line and then finding the difference in time and then write the result into a new file, the problem is that it only write the first 350 lines out of 35734 lines, any idea why please?
 
@Ffisegydd Thank you for your answer! So I need to remove [] to have:
STATICFILES_DIRS = os.path.join(os.path.dirname(__file__),'static').replace('\\','/')
?
 
@user1653150 you've asked your question but it looks like no one is able to help you, please don't ask repeatedly. You can always make a question on the Stack Overflow site itself
@Fuiba yeah exactly if you want it to be a string, rather than a list with one string inside it :)
 
thanks
 
@Ffisegydd thank you!
 
10:04 PM
@Fuiba no problem :) good luck with your programming
 
Guys a question: I would like to write a customized parsing py because the file's are have are neither sgml nor html ( sec.gov/Archives/edgar/data/10795/000119312514042815/… )bs4 does not work on them etc.... do you know some material with neat examples where i can learn to write text-parsing code in python?
thnx
 
@Ffisegydd if i take the code to extract a number from k files do you know how to organize them into one array
array_weight = [result]
 
Hang on a sec
 
# List of your files.
files = [...]

# Results list
results = []

# Iterate over your files
for file in files:
    # Open each file individually
    with open(file, 'r') as f:
        # Find your results in each file.
        result_str = re.findall(r"[-+]?\d*\.\d+|\d+", f.read())
        # Append your float to results
        results.append(float(result_str[0]))
There's some pseudo code. I don't know how you work with files, whether you need f.read(), f.readlines(), or whatever. You'll have to sort that out yourself.
 
10:15 PM
thats great thank you
 
cabbage all
 
cbg @Raoul
 
 
@Raoul thnx i'll look it up!!!
 
10:41 PM
for filename in glob.iglob('*.html'):
with open(filename) as f:
soup = BeautifulSoup(f)
results = []

weight = soup.find('b', text='Shipping Weight:').next_sibling
title = soup.find("span", id="btAsinTitle")

"""print {'weight': weight,
'title': title.get_text(),}"""

results = weight
import re


result_str = re.findall(r"[-+]?\d*\.\d+|\d+", results)
result = results.append(float(result_str[0]))
#print result

array_weight = [result]

print array_weight
but i get the follwoing error 'NavigableString' object has no attribute 'contents'
 
turns out people that are Canadian don't like you thinking they're American
 
@Jon yeah don't go do that!
Rep cap beated. 2400 rep now. Close to 3000 @Jon! Then the world!
 
she did admit to living in NY for 12 years... so her accent was defintely American
no doubt you'll be joining us in the 20k club :)
 
Pssh. I doubt it. I'll be happy with 3k for now :P
 
Forgot they even existed!
 
10:51 PM
How is that video not available in the US...
 
no idea
 
@Ffisegydd I'm trying to bin the floats into packages no larger than 10
can you take a look at my code?\
or someone that is familiar with this
for filename in glob.iglob('*.html'):
    with open(filename) as f:
        soup = BeautifulSoup(f)
        results = []

        weight = soup.find('b', text='Shipping Weight:').next_sibling
        title = soup.find("span", id="btAsinTitle")

        """print {'weight': weight,
               'title': title.get_text(),}"""

        results = weight
        import re
        import scipy
        import numpy as np

        result_str = re.findall(r"[-+]?\d*\.\d+|\d+", results)
        result = float(result_str[0])
 
and old favourite (yet again) youtube.com/watch?v=4ot2PCwGF-s
 
05:00 - 19:0019:00 - 00:00

« first day (1288 days earlier)      last day (3677 days later) »