homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums!


  New Poll  
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums!   » The Archives   » The Big Archives   » Me 3vil, me choose Python (Page 1)

 - UBBFriend: Email this page to someone!  
This topic comprises 2 pages: 1  2 
 
Author Topic: Me 3vil, me choose Python
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 11 posted June 23, 2003 10:14      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
But only because someone gave it to me on a round shiny object with a hole in the middle and it came complete with sweets and crisps!

Now I'm wondering; what is a string??

It says: Write a program that prints your full name and your birthday as separate strings.

Is this correct??

#namn och fodelsedag = mitt forsta egna program
print "ph34r teh fluf1 bun1"
print "19 juni 2003"

And how come I couldn't use Ö?? It refused to save when I had written: #namn och födelsedag = mitt första egna program. Coincidence or sinister bug?

--------------------
"Professional software should have dancing pigs in pink tutus"

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
iCoach
Geek
Member # 2141

Member Rated:
3
Icon 2 posted June 23, 2003 11:45      Profile for iCoach     Send New Private Message       Edit/Delete Post 
quote:
Originally posted by ph34r teh fluf1bun1:
But only because someone gave it to me on a round shiny object with a hole in the middle and it came complete with sweets and crisps!

Now I'm wondering; what is a string??

It says: Write a program that prints your full name and your birthday as separate strings.

Is this correct??

#namn och fodelsedag = mitt forsta egna program
print "ph34r teh fluf1 bun1"
print "19 juni 2003"

And how come I couldn't use Ö?? It refused to save when I had written: #namn och födelsedag = mitt första egna program. Coincidence or sinister bug?

Well I am not all that familiar with Python, but what "string" refers to is a series of Alpha-numeric characters stored in a variable. As opposed to Integers (numeric only), Boolean (True/False) etc...

So in essence what it is saying is (my guess/interpretation) put your name and birthday into seperate string variables then print those variables.

Unfortunately I don't speak Swedish so I can't understand "#namn och födelsedag = mitt första egna program". But the Print lines are pretty universal. It is close, but assign "ph34r teh fluf1 bun1" and "19 juni 2003" to two string variables, then print the two variables.

Of course that is the literal interpretation of the description of "seperate strings".

As for why "Ö" wouldn't work is that it is most likely not in the interpreter since an omlaut (sp?) isn't usually seen in programming languanges. It isn't much of a coincidence, a bug no...

It is a sinister plan to force all not English speakers to stop using freakish marks around their O's and C's. [devil wand]

--------------------
Never upset a goalie - getting punched with a blocker is not a pleasant experience - facemask or not.

Posts: 164 | From: Wisconsin | Registered: Apr 2003  |  IP: Logged
Coffee_geek
Assimilated
Member # 1608

Member Rated:
5
Icon 1 posted June 23, 2003 12:30      Profile for Coffee_geek   Author's Homepage     Send New Private Message       Edit/Delete Post 
OOO! Python! A beautiful language, though a bit childish. Not childish as in simple or not useful, but childish in that it's fun and easy to use. An unsung language, truly, and probably a good starter language. Can't really help you with it though, I'm just learning it myself.

Seeming and Dreaming,
Coffee

--------------------
We got, ten minutes to get there
We got, ten minutes to go
Throw this one in for the money
Cause the next one's for the next show

Posts: 464 | From: Varies | Registered: Aug 2002  |  IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 10 posted June 23, 2003 12:39      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
I'm on something like page 2 of the non-programmers guide so me thinks you could be very helpful... [Confused]

Änd yöu shåll nöt succeed!! The freäkish märks will täke över the wörld!! [devil wand]

--------------------
"Professional software should have dancing pigs in pink tutus"

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
uilleann
Discontinued


Icon 1 posted June 23, 2003 15:30            Edit/Delete Post 
Moreoever, what didn't let you save the program with ö in? Are you using an integrated editor inside the python package, or just a regular text editor?

I'm personally suprised that it noticed - I don't know why it wouldn't just write out the letter the same as any other, same as anything else. What OS is this?

It shouldn't affect the interpreter, as it was inside a comment and the interpreter would just ignore it. For that matter, I've used extended ASCII characters before directly inside strings inside other languages, and it's not generally a bother.

I don't know if it's a bug or not, as I don't really know what on earth it's doing - why it would be taking an exception to the character? Maybe it's deciding that it needs to save to unicode and is then hitting a problem? What exactly was the error message anyhow?

IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 11 posted June 24, 2003 05:23      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
Hmm, now you are asking lots of hard questions I don't understand... [Frown]

Well, I noticed this when writing a comment # before my actual program. Since it says in my manual that you are supposed to do that.... Anyway so I noticed that if my comment had an å, ä or ö in it I couldn't save the program (and to clearify this I write the actual program in English).

It gives a looooong error message, and oh I write in IDLE, and then 'new window', the error message comes in the *Python Shell* window.

--------------------
"Professional software should have dancing pigs in pink tutus"

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
iCoach
Geek
Member # 2141

Member Rated:
3
Icon 4 posted June 24, 2003 06:07      Profile for iCoach     Send New Private Message       Edit/Delete Post 
quote:
Originally posted by ph34r teh fluf1bun1:
Änd yöu shåll nöt succeed!! The freäkish märks will täke över the wörld!! [devil wand]

ACKKPPBBTT!!!
The pain! The anguish!


I feel... weak...

::thump::

--------------------
Never upset a goalie - getting punched with a blocker is not a pleasant experience - facemask or not.

Posts: 164 | From: Wisconsin | Registered: Apr 2003  |  IP: Logged
uilleann
Discontinued


Icon 1 posted June 24, 2003 15:21            Edit/Delete Post 
ph34r:
*shrugs* I cannot read minds; hell, I don't even know Python. I'd want the actual error message (that it is "looooong" doesn't count) to be able to make a sensible guess as to the problem.

I copied/pasted your code into Mac Python, put the comment with the fancy letters in, and both ran and saved it successfully - no errors.

IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 9 posted June 25, 2003 03:05      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
Yes, uilleann, you are right uilleann. Me a bad Bun1.

Here's the error message. I'm not sure if it's the same one since I haven't managed to memorise it but I tried doing what I always try: saving with å, ä or ö - characters present.

(and just for the record, it's not the actual program).

>>> Exception in Tkinter callback
Traceback (most recent call last):
File "C:\PYTHON22\lib\lib-tk\Tkinter.py", line 1316, in __call__
return apply(self.func, args)
File "C:\PYTHON22\Tools\idle\IOBinding.py", line 136, in save_as
if self.writefile(filename):
File "C:\PYTHON22\Tools\idle\IOBinding.py", line 151, in writefile
chars = str(self.text.get("1.0", "end-1c"))
UnicodeError: ASCII encoding error: ordinal not in range(128)

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
Stereo

Solid Nitrozanium SuperFan!
Member # 748

Member Rated:
5
Icon 1 posted June 25, 2003 07:47      Profile for Stereo     Send New Private Message       Edit/Delete Post 
(Do I hate Explorer? One window had a problem, but it closed all of my open ones, including a long answer to your error message. So forgive me if this one is not the extensive answer for beginner I first wrote.)

So the short answer is, you can't use accents at all, not even in comments.

A quick search tells me Python itself can handle accents (both extended ASCII and Unicode), so it is probably due to your editor/Python interpreter being too old to handle them - or the programmer(s) (not you, but those who wrote the editor/interpreter you use) who haven't thought of all those languages using accents, and were happy with the original 7-bit ASCII encoding.

If you don't know what ASCII, extended ASCII and Unicode are, or anything about character encoding, may I suggest a quick search on the Internet? There are plenty of pages explaining them in depths, like this one or that one. (The latter goes beyond computer encoding, and goes as far back as the Morse code and the teletype.) Enjoy!

Posts: 2289 | From: Gatineau, Quebec, Canada | Registered: Apr 2001  |  IP: Logged
uilleann
Discontinued


Icon 1 posted June 25, 2003 17:15            Edit/Delete Post 
Looking at that error, it wouldn't have "Unicode" in it if it was trying to do 7-bit encoding... actually, what on earth would even use 7-bit encoding now anyhow? It's not like you can write a block of text in memory to disc in 7-bit format, surely? If anything, a basic save would just dump the text out to disc and not care about what it contains. I'd suspect a dumb bug in the python Unicode support.

On the other hand, is this trying to save an 8-bit text file from a Unicode Windows text-edit box? And finding that those characters are outside the permitted 8-bit range?

Maybe your python needs an upgrade? If not, then maybe mail the developers or post to their bug tracker page or something - wake them up a bit :-)

IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 7 posted June 26, 2003 07:30      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
uilleann, it's very sweet of you to reply and try to help; but do you think you could provide a translation?!

After having read your message 4-5 times, taken a long walk and read it a few more times I think I might understand.

Now how do I know which characters are permitted?
Is there a list of the allowed 8-bit characters?
(I figure that's the version I got because I think I got the latest one).

I think that might be the problem since I open IDLE and then from the Shell window open a new window. And I think that is what you mean when you say:
quote:
is this trying to save an 8-bit text file from a Unicode Windows text-edit box? And finding that those characters are outside the permitted 8-bit range?
I feel stupid now... [blush]
Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
Stereo

Solid Nitrozanium SuperFan!
Member # 748

Member Rated:
5
Icon 1 posted June 26, 2003 08:31      Profile for Stereo     Send New Private Message       Edit/Delete Post 
Ok. Let's look a bit closer at that error message.

1- An exception was raised
2- while saving the file
3- no character with a value higher than 128 accepted.

Original ASCII: 7 bits encoding plus 1 bit checksum, so maximum number of 128 character codes available.

'ö' is not in original ASCII list. (Actually, bunn1, no accents are available in original ASCII, don't use them and you'll be OK.)

So that's why I guess the editor is quite old and its internal char value is meant for original ASCII. (Oh, and the programmer didn't properly handled the exception, but if it is really an old editor created when there were no 8 bits + encoding available, one may forgive him/her.)

So, it's not really your fault, bunn1. Just don't use accents, or find another editor.

Posts: 2289 | From: Gatineau, Quebec, Canada | Registered: Apr 2001  |  IP: Logged
iCoach
Geek
Member # 2141

Member Rated:
3
Icon 1 posted June 26, 2003 08:35      Profile for iCoach     Send New Private Message       Edit/Delete Post 
quote:
Originally posted by Stereo:
Ok. Let's look a bit closer at that error message.

1- An exception was raised
2- while saving the file
3- no character with a value higher than 128 accepted.

Original ASCII: 7 bits encoding plus 1 bit checksum, so maximum number of 128 character codes available.

'ö' is not in original ASCII list. (Actually, bunn1, no accents are available in original ASCII, don't use them and you'll be OK.)

So, it's not really your fault, bunn1. Just don't use accents, or find another editor.

Long live the conspiracy! Down with freakish marks!

--------------------
Never upset a goalie - getting punched with a blocker is not a pleasant experience - facemask or not.

Posts: 164 | From: Wisconsin | Registered: Apr 2003  |  IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 10 posted June 26, 2003 08:47      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
Very nice öf yöu tö prövide å tränslåtiön!!

Nöw when I knöw it's nöt my fåult I shäll pröcide tö take över the wörld by writing ä prögräm thåt will ållöw åll märks tö be freäkish, wether they wånt tö ör nöt!!

*Mwäääähähää* (evil läugh) [devil wand]

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
iCoach
Geek
Member # 2141

Member Rated:
3
Icon 1 posted June 26, 2003 09:13      Profile for iCoach     Send New Private Message       Edit/Delete Post 
Ok, as a side and slightly off-topic note... How do you get the freakish marks? I use a M$ ergo-keyboard, I know there are alt codes for freaky characters like Þ and ß but it seems wrong to require people to hold down alt and punch a 4 digit code to get "ü" or "é"

I realize that it is most likely just a different keyboard layout but... Anyone have a screenshot of the layout?

--------------------
Never upset a goalie - getting punched with a blocker is not a pleasant experience - facemask or not.

Posts: 164 | From: Wisconsin | Registered: Apr 2003  |  IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 11 posted June 26, 2003 09:41      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
I was considering to write:

I cannot tell you since these freakish marks are mine, mine I say!!

But if you download a little .exe all your marks will be freakish from now on...

*mwaahhahahaaa* [devil wand]


But then I realised I didn't actually have a .exe like that. So yes, it's a different keyboard layout. Since å, ä and ö are considered to be quite important letters in the Swedish alphabet they have actually given them keys of their own. Just like real letters! Imagine that... [shake head]

--------------------
"Professional software should have dancing pigs in pink tutus"

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
uilleann
Discontinued


Icon 1 posted June 26, 2003 13:40            Edit/Delete Post 
iCoach:
There is a concession in Windows - if you run Word, you can type things like ctrl-', e for é. Windows does need a more global method of inserting accents, though, as Mac OS and *NIX both have one similar to Word's that works in all apps. (Well, in *NIX, it might only work under X-Windows - never tried it).

Stereo:
Uh... that editor must be pretty old if it's doing something like that. But it doesn't explain why Unicode came up in the error.

Anyhow, isn't there a newer version of python that's not still trapped back in the Dark Ages?

IP: Logged
Stereo

Solid Nitrozanium SuperFan!
Member # 748

Member Rated:
5
Icon 1 posted June 26, 2003 14:04      Profile for Stereo     Send New Private Message       Edit/Delete Post 
quote:
Originally posted by uilleann:

Stereo:
Uh... that editor must be pretty old if it's doing something like that. But it doesn't explain why Unicode came up in the error.
[/QB]

That's what I thought too. But a second guess (cause that's all it is, having no access to any other info like the original date of creation and such) is it could be a re-wrapped version. What I mean is, it was an old version that have had some code added in order to work with recent OS. So the typing is done with 'modern' Unicode support, but when the times come to save it (and probably interpret it or anything requiring more than just text-editing capabilities), the text in Unicode is changed into ASCII... without checking first if the Unicode character is a valid original ASCII one too.

(That sounds logic to me. Isn't reuse of code a big plus in programming? It often also means 'reuse of bugs', but who cares... [evil] )

Again, this is only a wild guess. Bunn1, could you give us the information that shows up either in the 'about' box or in the 'property'/'info'/whatever it's called window of the application (or even both)? Then a search on the Internet could bring up an history of the error. Although it's out of pure curiosity; I'll still sleep at night if I don't get the answer...

--------------------
Eppur, si muove!

Galileo Galilei

Posts: 2289 | From: Gatineau, Quebec, Canada | Registered: Apr 2001  |  IP: Logged
uilleann
Discontinued


Icon 1 posted June 26, 2003 18:17            Edit/Delete Post 
Were I her, I'd sooner just bloody upgrade it :P
IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 9 posted June 27, 2003 04:39      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
But I think I do have the latest version:

Python 2.2.3 realised in May 2003???

Stereo, I don't understand what it is you want me to find? I've tried but can't come up with anything???

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
Stereo

Solid Nitrozanium SuperFan!
Member # 748

Member Rated:
5
Icon 1 posted June 27, 2003 07:08      Profile for Stereo     Send New Private Message       Edit/Delete Post 
(I'll assume you have Widows something on your computer.)

It is not Python that cause the problem, but the editor (or so I think). You said you were using IDLE. If you right-click on the icon of IDLE and select "property" (or whatever it is called in Swedish, but it is usually the last one in the menu that pops up), and then click the "version" tab (once again, "or whatever the equivalent is in Swedish") there should be some informations that comes out: the version, copyright, date, full name, and then some more.

Also, if you launch your application, there is usually an "about this application" option in some menu. This should show pretty much the same kind of informations, sometimes more, somtimes less. With that info, one can identify precisely the application, and from there, usually find a list of bugs/known issues/features on the 'net.

Sorry, if it wasn't clear in my previous message. I'll try to better tailor my future explanations for your actual level.

Posts: 2289 | From: Gatineau, Quebec, Canada | Registered: Apr 2001  |  IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 1 posted June 27, 2003 08:28      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
quote:
Originally posted by Stereo:

Sorry, if it wasn't clear in my previous message. I'll try to better tailor my future explanations for your actual level.

Ouch, now that hurt... [cry baby]

But I get the picture now! I shall set out on a Net Quest to search for this so I'm not clogging up the entire forum. [Big Grin]

--------------------
"Professional software should have dancing pigs in pink tutus"

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged
Stereo

Solid Nitrozanium SuperFan!
Member # 748

Member Rated:
5
Icon 1 posted June 27, 2003 09:00      Profile for Stereo     Send New Private Message       Edit/Delete Post 
quote:
Originally posted by ph34r teh fluf1bun1:
quote:
Originally posted by Stereo:

Sorry, if it wasn't clear in my previous message. I'll try to better tailor my future explanations for your actual level.

Ouch, now that hurt... [cry baby]

Didn't meant to, I swear! [blush]

When explaining something, one usually assume some level of prior knowlege. Setting the explanation level too high (or too low) is a problem of the one explaining, not the one the explanation is for! Setting a level too high, the 'receiver' doesn't understand, so can't learn. Too low, the receiver get bored, doesn't listen anymore, and doesn't learn. In both cases, it is no good.

So it was really an admission of my inabilty to correctly judge your level of knowlege based on your previous comments. (Will you forgive me? [weep] ... [Wink] )

And don't worry, I'm sure you'll soon be teaching us a lot about Python!

--------------------
Eppur, si muove!

Galileo Galilei

Posts: 2289 | From: Gatineau, Quebec, Canada | Registered: Apr 2001  |  IP: Logged
ph34r teh fluf1bun1
Geek
Member # 2245

Member Rated:
5
Icon 7 posted June 27, 2003 10:41      Profile for ph34r teh fluf1bun1     Send New Private Message       Edit/Delete Post 
quote:
Originally posted by Stereo:

So it was really an admission of my inabilty to correctly judge your level of knowlege based on your previous comments. (Will you forgive me? [weep] ... [Wink] )

And don't worry, I'm sure you'll soon be teaching us a lot about Python!

Yes, yes... Bunny happy now!! [Big Grin]

Awww, Stereo thinks Bunny writes clever posts!! [crazy]

Posts: 241 | From: Sweden | Registered: Jun 2003  |  IP: Logged


All times are Eastern Time
This topic comprises 2 pages: 1  2 
 
  New Poll   Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

© 2018 Geek Culture

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam