|
deimos posted:I am gonna ask the boss for PyCon, and I am pretty sure I am going to go regardless of job paying for it, at the very least for the conference. Yes, I do - I think a lot of us, myself included, largely agreed with Bruce. I think things will be changed quite a bit, and I know that the pycon organizers are watching out for this pitfall this year. Also, I have two talks. You should go. I did a post this morning which may be the first of many
|
# ? Jan 29, 2009 17:28 |
|
|
# ? May 14, 2024 01:37 |
|
m0nk3yz posted:Yes, I do - I think a lot of us, myself included, largely agreed with Bruce. I think things will be changed quite a bit, and I know that the pycon organizers are watching out for this pitfall this year. Already read it, you're on my RSS.
|
# ? Jan 29, 2009 18:46 |
|
deimos posted:I am gonna ask the boss for PyCon, and I am pretty sure I am going to go regardless of job paying for it, at the very least for the conference. I attended last year and I really enjoyed it. This year I have the privilege of speaking and am once again really looking forward to it. One of the big things Bruce mentions, sponsored keynotes, I don't think we're having this year.
|
# ? Jan 30, 2009 01:52 |
|
This is my first time using Python and I'm trying to design a web app. For now, I just want to create a simple "Hello World" type deal just to learn how Python works. In PHP it's as simple as writing a hello.php file, echoing text and then uploading it to the server. Since I do not have command line access, just FTP access to our web server, is it even possible for me to create a site in Python? All the Python tutorials refer me to Django to build a site, and all the Django tutorials start with "run this on the command line". Are there any good online tutorials for degenerate PHP losers such as myself that are trying to learn this for the first time?
|
# ? Jan 30, 2009 17:17 |
|
Stephen posted:This is my first time using Python and I'm trying to design a web app. For now, I just want to create a simple "Hello World" type deal just to learn how Python works. For learning probably get a 10MB account at http://www.alwaysdata.com/ it's free. Basically click "Inscription" then: on the first line enter the subdomain you want on the second pick any of the options on the third input pick "Pack Gratuit (10Mo) (click button) Adresse email = Email Address Mot de passe = password Confirmez le mot de passe = confirm password Pays = Country (pick États-Unis) (click button) (click button) last window tells you: username is gonna be your emailprosper.spurius@gmail.com ; ftp server address is: ftp.alwaysdata.com and your login is <subdomain name> ssh address is: ssh.alwaysdata.com and your login is <subdomain name>. You have to turn it on on the administration console. your web address is http://<subdomain>.alwaysdata.net/ The admin is also in french, but you can probably figure it out. (I am not actually a french speaker but I speak spanish natively and can speak catalan so french is relatively easy to read to me.) edit: of course the alternative is getting one of the $10-30 a year packages that host python/django in english. deimos fucked around with this message at 17:35 on Jan 30, 2009 |
# ? Jan 30, 2009 17:23 |
|
deimos posted:For learning probably get a 10MB account at http://www.alwaysdata.com/ it's free. I guess I'm just a little confused on the whole process of how a web app is created using Python.
|
# ? Jan 30, 2009 17:40 |
|
Stephen posted:Yeah this won't really help. I already have the hosting and server, I just don't have command line access. Basically I've been given a project to do at my job that is easy to build and has a distant deadline and I thought it would be good to branch out my skills a bit by learning Python. Unfortunately I won't be able to use Python if I can't just build a site and then upload it a la PHP. Your company is using a host to which you don't have shell access?
|
# ? Jan 30, 2009 17:45 |
|
deimos posted:Your company is using a host to which you don't have shell access? Correct. I'm just a lowly Web Developer. I can't be trusted with such toys. Up until now, we've simply used PHP to build all our pages so it hasn't been needed anyways.
|
# ? Jan 30, 2009 17:51 |
|
Stephen posted:Correct. I'm just a lowly Web Developer. I can't be trusted with such toys. Up until now, we've simply used PHP to build all our pages so it hasn't been needed anyways. Anyway, you could try something like web.py as your web framework, which is much smaller than Django and is likely easier to install. Haven't tried it yet myself.
|
# ? Jan 30, 2009 18:06 |
|
If you only have FTP access getting python to work is likely going to be beyond what you want to do unless someone who has shell access is willing to do the intial setup.
|
# ? Jan 30, 2009 19:05 |
|
Is there an easy way to randomize the retrieval of key, value pairs from a dict? I have a paired list of {English : German} words, and I want to randomly pull an English word and its German translation. I know about d.keys(), but I'm not sure how to randomly select one from the result.
|
# ? Jan 30, 2009 20:05 |
|
Kire posted:Is there an easy way to randomize the retrieval of key, value pairs from a dict? code:
|
# ? Jan 30, 2009 20:24 |
|
Kire posted:Is there an easy way to randomize the retrieval of key, value pairs from a dict? why not choice = random.choice(d.keys())? code:
|
# ? Jan 30, 2009 20:45 |
|
I think for his purposes something more likecode:
|
# ? Jan 30, 2009 20:54 |
|
Stephen posted:Correct. I'm just a lowly Web Developer. I can't be trusted with such toys. Up until now, we've simply used PHP to build all our pages so it hasn't been needed anyways. Tell your admins to set up django or mod_python for you, once that is done you can just drop files in a directory. mod_python can be set up to work just like php. For testing you can run django localy on the local server. We'd be more than happy to help you in the django thread if you go that way.
|
# ? Jan 30, 2009 21:28 |
|
deimos posted:Tell your admins to set up django or mod_python for you, once that is done you can just drop files in a directory. mod_python can be set up to work just like php. Kire posted:Is there an easy way to randomize the retrieval of key, value pairs from a dict?
|
# ? Jan 31, 2009 03:15 |
|
Habnabit posted:Bleh mod_python. There's more problems with it that aren't even listed on that page, too. It would be better to use mod_wsgi, given the option. Its configuration is simpler, and it also supports adding actions to file types. configuration is simpler depending on the distribution, I had a nightmare of a time getting it to work on centos. mod_python is old dependable, I don't use it but it's what's easiest to install.
|
# ? Jan 31, 2009 09:28 |
|
deimos posted:I am gonna ask the boss for PyCon, and I am pretty sure I am going to go regardless of job paying for it, at the very least for the conference. I know a couple of developers who have decided to give 09 a miss due to the poo poo that went on with the last pycon. Spending $5K+ to fly from australia to go to a conference on the other side of the earth only to have it wrecked by blatant spamming by vendors doesn't endear folks to the organisation of it all.
|
# ? Jan 31, 2009 18:46 |
|
duck monster posted:I know a couple of developers who have decided to give 09 a miss due to the poo poo that went on with the last pycon. Spending $5K+ to fly from australia to go to a conference on the other side of the earth only to have it wrecked by blatant spamming by vendors doesn't endear folks to the organisation of it all. And they're shortsighted if they don't think the organizers didn't listen to the feedback or attempt to change things. Everyone involved in 08 admitted to the mistakes, and steps were taken to rectify it.
|
# ? Jan 31, 2009 18:49 |
|
EDIT: Never mind, I'm retarded.
sd6 fucked around with this message at 02:10 on Feb 2, 2009 |
# ? Feb 1, 2009 20:38 |
|
Anyone looking for a giant read, I just reprinted an old article of mine on Python threads the and global interpreter lock. I'm going to be publishing all of my stuff through 2008 soonish.
|
# ? Feb 1, 2009 23:23 |
|
m0nk3yz posted:Anyone looking for a giant read, I just reprinted an old article of mine on Python threads the and global interpreter lock. I'm going to be publishing all of my stuff through 2008 soonish.
|
# ? Feb 2, 2009 13:44 |
|
deimos posted:I realize now that single article is like 6500 words. I should make a cliff notes version.
|
# ? Feb 2, 2009 14:12 |
|
Very very new to Python (learnt BASIC way back in the day). I've followed what I can of some tutorials but need answers to the following: 1. How can I embed a string within an outputted line? Example: code:
What code do I need to use to get the strings x and y into my output? 2. How can I get outputs to split between lines? Desired output: This is line 1 with variable1 This is line 2 with variable2 something like: code:
|
# ? Feb 3, 2009 00:51 |
|
1. Use the + operator to append variables to strings.code:
code:
|
# ? Feb 3, 2009 01:17 |
|
Nigel Tufnel posted:Very very new to Python (learnt BASIC way back in the day). I've followed what I can of some tutorials but need answers to the following: Optimally you might use some sort of string interpolation (google it), but perhaps a little more understandably print 'there is' + X + ' or ' + Y Note, you can have type errors with this, so be careful. quote:What code do I need to use to get the strings x and y into my output? print 'this is line 1 with '+variable2 Dont worry about the '\n' with print, because it does it automatically. Theres also the option with print to use commas to separate stuff ie print 'this is line 1 with' , variable1 print 'this is line 1 with' , variable2 and infact that might even be better because its less likely to poo poo itself if you have to mix string and int, although I still think string interpolation is the way to go, however I dont have the time to explain it, so google is your friend.
|
# ? Feb 3, 2009 01:23 |
|
The other way to do it.. I prefer this way..code:
code:
|
# ? Feb 3, 2009 05:09 |
|
I know there was some discussion about contextmanagers earlier in the thread, as an FYI I just put the article from pymag up which gives a lot more information. It's only 2000 words or so, so I shouldn't get yelled at for it being too long. Here.
|
# ? Feb 3, 2009 15:38 |
|
m0nk3yz posted:I know there was some discussion about contextmanagers earlier in the thread, as an FYI I just put the article from pymag up which gives a lot more information. It's only 2000 words or so, so I shouldn't get yelled at for it being too long. Here. tl;dr Seriously though, that was a great article makes me wonder if getting the Python Mag is worth it after all. (I assume you get a subscription for free for being a contributor? How is it?) I also need to work through your other, longer recent reposts sometime; skipped them for now, not really due to the length but due to not caring as much about threading (yet).
|
# ? Feb 3, 2009 19:43 |
|
bitprophet posted:tl;dr Nope, no free subscription - they pay you to write articles though. I'm an associate editor too, so I get to do technical reviews. I'll be pushing a few more up (one on paramiko) as the week goes on, given I've braincramped trying to grok twisted.
|
# ? Feb 3, 2009 20:37 |
|
unpack("8s","MAP01\0\0\0") gave me MAP01\0\0\0: it seems 8s is not handled as a zero-terminated string, but as a fixed-length blob. The best I could come up with was a wrapper around unpack:code:
|
# ? Feb 3, 2009 22:59 |
|
RjY posted:unpack("8s","MAP01\0\0\0") gave me MAP01\0\0\0: it seems 8s is not handled as a zero-terminated string, but as a fixed-length blob. The best I could come up with was a wrapper around unpack: It does support them, unpack determines the size of the resulting container. MAP01\0\0\0 is the correct output, try printing it and you'll see it prints correctly. Also to clean it: code:
deimos fucked around with this message at 23:51 on Feb 3, 2009 |
# ? Feb 3, 2009 23:44 |
|
deimos posted:It does support them, unpack determines the size of the resulting container. MAP01\0\0\0 is the correct output, try printing it and you'll see it prints correctly. deimos posted:
|
# ? Feb 4, 2009 00:53 |
|
RjY posted:Maybe it's correct from the point of view of python, which can obviously handle zero bytes in strings, and so can treat them as arbitrary binary blobs - but in C (which is where this data is coming from) strings are terminated with a zero so the correct output should just be MAP01. In C it's extremely common to put a variable-length zero-terminated string into a fixed-size character array and I am surprised unpack won't do this for me. (Especially when it handles Pascal-style length-prefixed strings - compared to C, how common are they?) Its doing the correct thing, it sounds like you are just confused about the way it works. >>> teapot = unpack('8s', 'MAP01\0\0\0') >>> teapot ('MAP01\x00\x00\x00',) The value of teapot is a tuple because unpack always returns a tuple, even with just one value. The size of teapot is determined by the size of the string you gave it- notice that its preserving the extra null characters. >>> print teapot[0] MAP01 >>> print ''.join(teapot) MAP01 Its printing the correct value. When you just call unpack from a prompt interactively it will show you null characters as well if they exist. What are you intending to do, toss out the trailing nulls?
|
# ? Feb 4, 2009 12:09 |
|
tripwire posted:Its printing the correct value. When you just call unpack from a prompt interactively it will show you null characters as well if they exist. What are you intending to do, toss out the trailing nulls? The interactive prompt always prints out the __repr__ which is the cause of this. RjY posted:All right but if I have more in the format string than 8s, or if the string I'm unpacking is 8 characters long and so doesn't have a \0 in it, it's just going to throw exceptions. (I am actually trying to unpack a struct { int offset, length; char name[8]; } using a format string of ii8s, but opted not to complicate the initial post with that) code:
deimos fucked around with this message at 15:20 on Feb 4, 2009 |
# ? Feb 4, 2009 15:15 |
|
mwarkentin posted:The other way to do it.. I prefer this way.. code:
Print has also been changed to a function. You can enable the print function syntax in 2.6 using from __future__ import print_function. I recommend any new to Python to start learning with version 2.6, as it is bridging the gap between Python 2 and 3. Inverness fucked around with this message at 18:43 on Feb 4, 2009 |
# ? Feb 4, 2009 18:41 |
|
tripwire posted:Its printing the correct value. When you just call unpack from a prompt interactively it will show you null characters as well if they exist. What are you intending to do, toss out the trailing nulls? The fact that you can't see the null bytes when you print the string is irrelevant. He just needs to get over it and do s.rstrip('\x00').
|
# ? Feb 4, 2009 19:28 |
|
Inverness posted:I recommend any new to Python to start learning with version 2.6, as it is bridging the gap between Python 2 and 3. I'll add something about this to the OP sooner or later.
|
# ? Feb 4, 2009 19:51 |
|
m0nk3yz posted:Anyone looking for a giant read, I just reprinted an old article of mine on Python threads the and global interpreter lock. I'm going to be publishing all of my stuff through 2008 soonish. Thank you for posting "A (BRIEF) INTRODUCTION TO PYTHON-CORE DEVELOPMENT", I've been meaning to mess around with the runtime for a while, this will be helpful when I get around to it in the spring
|
# ? Feb 5, 2009 01:54 |
|
|
# ? May 14, 2024 01:37 |
|
So even though I posted in this tread about getting into stackless months ago, I got busy and am now trying to get back into it. What I have is a simple program to generate a sine wave in an array and send it through an audio stream to the sound card without the intermediate step of writing a wave file. What I want is a way to play two different waves concurrently.code:
code:
code:
fart simpson fucked around with this message at 11:09 on Feb 5, 2009 |
# ? Feb 5, 2009 11:04 |