Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread Guy Tamir
On Sunday, June 9, 2013 9:24:56 PM UTC+3, Ian wrote: > On 09/06/2013 18:09, guytam...@gmail.com wrote: > > > Hi all, > > > > > > new to group and pretty new to python. > > > > > > I'm working on a new project and i want to receive a request from a user > > and to redirect him to a third party

Re: Re-using copyrighted code

2013-06-09 Thread Malte Forkel
Am 10.06.2013 07:31, schrieb Steven D'Aprano: > > But bringing it back to the original topic, I believe that the philosophy > of FOSS is that we should try our best to honour the intentions of the > writer, not to find some legal loophole that permits us to copy his or > her work against their

Re: Re-using copyrighted code

2013-06-09 Thread Steven D'Aprano
On Sun, 09 Jun 2013 14:08:54 -0700, Mark Janssen wrote: > I'm sorry, this is just the way it is -- everyone's just gone along with > the program tacitly because they get intimidated by the legal system. Your definition of "just the way it is" does not agree with mine. You're describing how you

Re: Re-using copyrighted code

2013-06-09 Thread Rick Johnson
On Sunday, June 9, 2013 7:26:43 PM UTC-5, Steven D'Aprano wrote: > When you listen to a song on the radio, do you know how they have a > copyright announcer read out the copyright and explicitly list all the > rights they keep after each and every song and advertisment? > No, me neither. It does

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
> Granted, IANAL, but the scholarly article I linked to above refers to > several of the same issues. I don't know about publication revoking > *all rights*, but there was definitely an understanding by the court > that publication meant a reduction of copyright claim. Again, I don't think I said

Re: Simple program question.

2013-06-09 Thread Chris Angelico
On Mon, Jun 10, 2013 at 1:06 PM, wrote: > if input()!=('duck', 'parry'): > if input()=='duck': > if input()=='parry': Every time you call input(), it waits for you to type something. You want to record what the person typed and then use it in each place. Have you been taught a means of doing thi

Re: Re-using copyrighted code

2013-06-09 Thread Chris Angelico
On Mon, Jun 10, 2013 at 10:34 AM, Steven D'Aprano wrote: > On Mon, 10 Jun 2013 08:07:57 +1000, Chris Angelico wrote: > >> On Mon, Jun 10, 2013 at 6:32 AM, Mark Janssen >> wrote: >>> That's not entirely correct. If he *publishes* his code (I'm using >>> this term "publish" technically to mean "pu

Re: Re-using copyrighted code

2013-06-09 Thread Michael Torrie
On 06/09/2013 08:30 PM, Mark Janssen wrote: >> Can you provide any citations for your interpretation? Besides "that's >> what the law should be", I mean. > > I don't think I even have to: the legal code you're citing above is > not very clear, consistent, or well-defined at all. As such, it show

Simple program question.

2013-06-09 Thread eschneider92
How do I make it so I only have to type in 'parry' once? import random words=['hemisses', 'hestabsyou'] randomizer=random.choice(words) if input()!=('duck', 'parry'): print('try again') if input()=='duck': print(randomizer) if randomizer=='hemisses': results=['you should have r

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
> What is clear is the mandate that sets up the framework in the first > place: > > "To promote the Progress of Science and useful Arts, by securing > for limited Times to Authors and Inventors the exclusive Right to > their respective Writings and Discoveries" > -- USC Articl

Re: Re-using copyrighted code

2013-06-09 Thread Tim Chase
On 2013-06-09 19:30, Mark Janssen wrote: > Thanks for digging out the legal code. Upon reading, it is > stunningly clear that the legal system has not established a solid > framework or arching philosophy in which to contain and express the > desire (in law) to protect content creators of all kind

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
> The fact that a work is non commercial is one of several factors that > is taken into account when determining fair use. It is not an > automatic fair use for non-commercial works. I have no idea where your > understanding of copyright law came from, but here is the relevant > section of the US l

Re: Re-using copyrighted code

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 6:40 PM, Mark Janssen wrote: >> Mark, ever watched TV? Or gone to the movies? Or walked into a bookshop? >> Listened to the radio? All these things publish copyrighted work. It is >> utter nonsense that merely publishing something in public gives up the >> monopoly privilege

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
> Mark, ever watched TV? Or gone to the movies? Or walked into a bookshop? > Listened to the radio? All these things publish copyrighted work. It is > utter nonsense that merely publishing something in public gives up the > monopoly privileges granted by copyright. That's not correct. Keep in min

Re: Re-using copyrighted code

2013-06-09 Thread Rick Johnson
On Sunday, June 9, 2013 4:08:54 PM UTC-5, zipher wrote: > >> That's not entirely correct. If he *publishes* his code (I'm using > > >> this term "publish" technically to mean "put forth in a way where > > >> anyone of the general public can or is encouraged to view"), then he > > >> is *tacitly

Re: Re-using copyrighted code

2013-06-09 Thread Michael Torrie
On 06/09/2013 02:32 PM, Mark Janssen wrote: > PyPi. But if you are *publishing*, there's no court which can > protect your IP afterwards from redistribution, unless you > explicitly *restrict* it. I am not a lawyer, and I haven't read the copyright act in its entirety, nor have I studied all the

Re: Re-using copyrighted code

2013-06-09 Thread Steven D'Aprano
On Mon, 10 Jun 2013 08:07:57 +1000, Chris Angelico wrote: > On Mon, Jun 10, 2013 at 6:32 AM, Mark Janssen > wrote: >> That's not entirely correct. If he *publishes* his code (I'm using >> this term "publish" technically to mean "put forth in a way where >> anyone of the general public can or is

Re: Re-using copyrighted code

2013-06-09 Thread Steven D'Aprano
On Sun, 09 Jun 2013 13:32:00 -0700, Mark Janssen wrote: > On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie > wrote: >> On 06/09/2013 11:18 AM, Mark Janssen wrote: >>> You actually do not. Attaching a legal document is purely a secondary >>> protection from those who would take away right already

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
> (Digression follows.) ...(by Gilbert and > Sullivan - one of my other loves), and according to US law at the > time, the publication (in this case, public performance, along with > the public sale of libretti (books of the words) and some sheet music) > of the work voided the authors' claim to ow

Re: Simple converter of files into their hex components... but i can't arrange utf-8 parts!

2013-06-09 Thread Chris Angelico
On Mon, Jun 10, 2013 at 7:06 AM, wrote: > Hi all, > I developed a script, which, IMHO, is more useful than the well > known bash "hexdump". > Unfortunately i can't arrange very easily the utf-8 encoding, > so in my output there is a loss of synchronization between the > the literal and the hex pa

Re: Re-using copyrighted code

2013-06-09 Thread Chris Angelico
On Mon, Jun 10, 2013 at 6:32 AM, Mark Janssen wrote: > That's not entirely correct. If he *publishes* his code (I'm using > this term "publish" technically to mean "put forth in a way where > anyone of the general public can or is encouraged to view"), then he > is *tacitly* giving up protections

Re: problem with if then

2013-06-09 Thread Roy Smith
In article <20165c85-4cc3-4b79-943b-82443e4a9...@w7g2000vbw.googlegroups.com>, Jean Dubois wrote: > But, really, > > once you've done all that (and it's worth doing as an exercise), rewrite > > your code to use urllib2 or requests.  It'll be a lot easier. > > Could you show me how to code the

RE: how to detect the character encoding in a web page ?

2013-06-09 Thread Carlos Nepomuceno
Try this: ### get_charset.py ### import re import urllib2 def get_charset(url): resp = urllib2.urlopen(url) #retrieve charset from header headers = ''.join(resp.headers.headers) charset_from_header_list = re.findall('charset=(.*)', headers) charset_from_header = charset_from_

Simple converter of files into their hex components... but i can't arrange utf-8 parts!

2013-06-09 Thread blatt447477
Hi all, I developed a script, which, IMHO, is more useful than the well known bash "hexdump". Unfortunately i can't arrange very easily the utf-8 encoding, so in my output there is a loss of synchronization between the the literal and the hex part... The script is not very long but is written n

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
>> That's not entirely correct. If he *publishes* his code (I'm using >> this term "publish" technically to mean "put forth in a way where >> anyone of the general public can or is encouraged to view"), then he >> is *tacitly* giving up protections that secrecy (or *not* disclosing >> it) would *a

Re: problem with if then

2013-06-09 Thread Jean Dubois
On 9 jun, 22:23, Roy Smith wrote: > In article > , >  Jean Dubois wrote: > > > I'm writing some code to check whether an url is available or not, > > therefore I make use of a wget-command in Linux and then check whether > > this is successful > > In general, "shelling out" to run a command-line

Re: problem with if then

2013-06-09 Thread Jean Dubois
On 9 jun, 22:29, Fábio Santos wrote: > On 9 Jun 2013 21:24, "Jean Dubois" > ...> And here is the result: > > > jean@antec4:~$ ./try.py > > wget -q -O - > > http://www.deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/E...> > >/dev/null ; echo $? > > 8 > > 2013-06-07 22:07:00.016807 stream

Re: Re-using copyrighted code

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 1:32 PM, Mark Janssen wrote: > On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie wrote: >> On 06/09/2013 11:18 AM, Mark Janssen wrote: >>> You actually do not. Attaching a legal document is purely a secondary >>> protection from those who would take away right already grante

Re: Re-using copyrighted code

2013-06-09 Thread Fábio Santos
On 9 Jun 2013 21:39, "Mark Janssen" wrote: > > On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie wrote: > > On 06/09/2013 11:18 AM, Mark Janssen wrote: > >> You actually do not. Attaching a legal document is purely a secondary > >> protection from those who would take away right already granted by

Re: [newbie] problem with if then

2013-06-09 Thread Albert Dengg
Jean Dubois wrote: ... > checkavailablestring='wget -q -O - >http://www.deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/EP_'+thisday.strftime("%y%m%d")+'_JO7 >>/dev/null ; echo $?' The problem schould be the echo: Since os.system returns the exit code of the shell, when chaining comma

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie wrote: > On 06/09/2013 11:18 AM, Mark Janssen wrote: >> You actually do not. Attaching a legal document is purely a secondary >> protection from those who would take away right already granted by US >> copyright. > > You are correct, except that the

Re: problem with if then

2013-06-09 Thread Fábio Santos
On 9 Jun 2013 21:24, "Jean Dubois" ... > And here is the result: > > jean@antec4:~$ ./try.py > wget -q -O - http://www.deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/EP_130607_JO7 > >/dev/null ; echo $? > 8 > 2013-06-07 22:07:00.016807 stream is available > wget -q -O - http://www.deredac

Re: [newbie] problem with if then

2013-06-09 Thread Roy Smith
In article , Jean Dubois wrote: > I'm writing some code to check whether an url is available or not, > therefore I make use of a wget-command in Linux and then check whether > this is successful In general, "shelling out" to run a command-line utility should be the last resort. It's slower,

Re: problem with if then

2013-06-09 Thread Jean Dubois
On 9 jun, 22:00, Fábio Santos wrote: > On 9 Jun 2013 20:49, "Jean Dubois" wrote: > > > > > I'm writing some code to check whether an url is available or not, > > therefore I make use of a wget-command in Linux and then check whether > > this is successful (returning a 0) or not returning an 8 > >

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 2:20 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 9 Ιουνίου 2013 12:12:36 μ.μ. UTC+3, ο χρήστης Cameron Simpson > έγραψε: >> On 09Jun2013 02:00, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= >> wrote: >> >> | Steven wrote: >> >> | >> Since 1 byte can hold up to 256 chars, why not

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 2:38 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 9 Ιουνίου 2013 12:20:58 μ.μ. UTC+3, ο χρήστης Lele Gaifax έγραψε: > >> > How about a string i wonder? >> > s = "νίκος" >> > what_are these_bytes = s.encode('iso-8869-7').encode(utf-8') > >> Ignoring the usual syntax error, this i

Re: [newbie] problem with if then

2013-06-09 Thread Fábio Santos
On 9 Jun 2013 20:49, "Jean Dubois" wrote: > > I'm writing some code to check whether an url is available or not, > therefore I make use of a wget-command in Linux and then check whether > this is successful (returning a 0) or not returning an 8 > However the if then statement seems to give the sam

Re: Re-using copyrighted code

2013-06-09 Thread Michael Torrie
On 06/09/2013 11:18 AM, Mark Janssen wrote: >> I understand that I have to pick a license for my package. > > You actually do not. Attaching a legal document is purely a secondary > protection from those who would take away right already granted by US > copyright. You are correct, except that th

[newbie] problem with if then

2013-06-09 Thread Jean Dubois
I'm writing some code to check whether an url is available or not, therefore I make use of a wget-command in Linux and then check whether this is successful (returning a 0) or not returning an 8 However the if then statement seems to give the same result in both cases: Here is my code: #!/usr/bin/

Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread Tim Chase
On 2013-06-09 10:09, guytam...@gmail.com wrote: > I'm working on a new project and i want to receive a request from a > user and to redirect him to a third party site, but on the page > after i redirect my users i want to them to see injected html (on > the third party site.) As others have stated

Re: Listing modules from all installed packages

2013-06-09 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年6月9日星期日UTC+8下午1時23分15秒寫道: > print '\n'.join([re.findall("from '(.*)'",str(v))[0] for k,v in > sys.modules.items() if str(v).find('from')>-1]) > > > > > Date: Sat, 8 Jun 2013 21:30:48 -0700 > > Subject: Listing modules from all installed packages > > From: jph...@gmail.co

Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread Roy Smith
On Sunday, June 9, 2013 8:22:17 PM UTC+3, Fábio Santos wrote: >> This does not seem like a python question, instead a HTML/JavaScript one. In article <0021fabe-78ed-4e79-8cdf-468b4ccc7...@googlegroups.com>, guytam...@gmail.com wrote: > its a python question since the request is received on a py

Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread Ian
On 09/06/2013 18:09, guytam...@gmail.com wrote: Hi all, new to group and pretty new to python. I'm working on a new project and i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on

Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread Joel Goldstick
On Sun, Jun 9, 2013 at 1:52 PM, wrote: > its a python question since the request is received on a python server and > i thought that > there may be a way to so from the server that sends the response to the > user... > > On Sunday, June 9, 2013 8:22:17 PM UTC+3, Fábio Santos wrote: > > On 9 Jun

Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread guytamir1
its a python question since the request is received on a python server and i thought that there may be a way to so from the server that sends the response to the user... On Sunday, June 9, 2013 8:22:17 PM UTC+3, Fábio Santos wrote: > On 9 Jun 2013 18:15, wrote: > > > > > > Hi all, > > > > >

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread nagia . retsina
Τη Κυριακή, 9 Ιουνίου 2013 3:36:51 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > > printing a greek Unicode string in the error with ASCII > > as the output encoding (default when not a tty IIRC). > An interesting thought. How would we test that? Please elaborare this for me. I ditn undertood

Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread Fábio Santos
On 9 Jun 2013 18:15, wrote: > > Hi all, > > new to group and pretty new to python. > > I'm working on a new project and i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on the third par

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
> At least partially, my confusion seems to be caused by the dichotomy of > the concepts of copyright and license. How do these relate to each other? A license emerges out of the commercial domain is purely about commercial protections. A copyright comes from the "academic" domain is pure about

Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread Joel Goldstick
On Sun, Jun 9, 2013 at 1:09 PM, wrote: > Hi all, > > new to group and pretty new to python. > > I'm working on a new project and i want to receive a request from a user > and to redirect him to a third party site, but on the page after i redirect > my users i want to them to see injected html (on

Re: A few questiosn about encoding

2013-06-09 Thread Chris “Kwpolska” Warrick
On Sun, Jun 9, 2013 at 12:44 PM, Νικόλαος Κούρας wrote: > A few questiosn about encoding please: > >>> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >>> values up to 256? > >>Because then how do you tell when you need one byte, and when you need >>two? If you read two bytes,

Redirecting to a third party site with injected HTML

2013-06-09 Thread guytamir1
Hi all, new to group and pretty new to python. I'm working on a new project and i want to receive a request from a user and to redirect him to a third party site, but on the page after i redirect my users i want to them to see injected html (on the third party site.) i'm not really sure how to

Re: A few questiosn about encoding

2013-06-09 Thread Nobody
On Sun, 09 Jun 2013 03:44:57 -0700, Νικόλαος Κούρας wrote: >>> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >>> values up to 256? > >>Because then how do you tell when you need one byte, and when you need >>two? If you read two bytes, and see 0x4C 0xFA, does that mean tw

Re: Re-using copyrighted code

2013-06-09 Thread Chris Angelico
On Mon, Jun 10, 2013 at 1:39 AM, Mark Janssen wrote: >> The Secret Labs license is very explicit: "All rights reserved". That line >> means you can't touch it under pain of lawsuit. > > That's not true. It means whatever rights they do have, they are > stating, in effect, that they have not give

Re: Re-using copyrighted code

2013-06-09 Thread Mark Janssen
> The Secret Labs license is very explicit: "All rights reserved". That line > means you can't touch it under pain of lawsuit. That's not true. It means whatever rights they do have, they are stating, in effect, that they have not given them away. But this is a difficult legal point, because by

Re: Re-using copyrighted code

2013-06-09 Thread Steven D'Aprano
On Sun, 09 Jun 2013 08:10:13 -0700, Rick Johnson wrote: > The Secret Labs license is very explicit: "All rights reserved". That > line means you can't touch it under pain of lawsuit. It's also very explicit that the code can be redistributed. However, there is no explicit rights to modification

Re: Re-using copyrighted code

2013-06-09 Thread Chris Angelico
On Mon, Jun 10, 2013 at 1:10 AM, Rick Johnson wrote: > On Sunday, June 9, 2013 8:21:43 AM UTC-5, Malte Forkel wrote: >> I have asked the PSF for help regarding the implications of the license >> status of code from sre_parse.py and the missing license statement in >> sre.py. I'll happily report t

Re: Re-using copyrighted code

2013-06-09 Thread Rick Johnson
On Sunday, June 9, 2013 8:21:43 AM UTC-5, Malte Forkel wrote: > I have asked the PSF for help regarding the implications of the license > status of code from sre_parse.py and the missing license statement in > sre.py. I'll happily report their answer to the list I they don't reply > in this thread

Re: Re-using copyrighted code

2013-06-09 Thread Chris Angelico
On Sun, Jun 9, 2013 at 11:21 PM, Malte Forkel wrote: > At least partially, my confusion seems to be caused by the dichotomy of > the concepts of copyright and license. How do these relate to each other? Ah, that one's easy enough to answer! When you create something, you own it. That is what cop

Re: Re-using copyrighted code

2013-06-09 Thread Kevin Walzer
On 6/8/13 5:31 PM, Malte Forkel wrote: Now, how am I supposed to deal with that? Ask Secret Labs for some kind of permission? Leave it as it is and add my own copyright line? Secret Labs AB is Frederic Lundh, author of the Python Image Library and many bits included in Python's stdlib. Here is

Re: Re-using copyrighted code

2013-06-09 Thread Malte Forkel
I have asked the PSF for help regarding the implications of the license status of code from sre_parse.py and the missing license statement in sre.py. I'll happily report their answer to the list I they don't reply in this thread. At least partially, my confusion seems to be caused by the dichotom

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Steven D'Aprano
On Sun, 09 Jun 2013 02:38:13 -0700, Νικόλαος Κούρας wrote: > s = 'α' > s = s.encode('iso-8859-7').decode('utf-8') > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 0: > unexpected end of data > > Why this error? because 'a' ordinal value > 127 ? Look at it this way... co

Re: Listing modules from all installed packages

2013-06-09 Thread cclauss
Adding : python -c 'help("modules") to the other two suggestions: #!/usr/bin/env python import commands, pkgutil, re, sys print('sys.modules.items()...') print('\n'.join(sorted([re.findall("from '(.*)'",str(v))[0] for k,v in sys.modules.items() if str(v).find('from')>-1]))) print('\npkgutil.it

Re: I used defaultdic to store some variables but the output is blank

2013-06-09 Thread Peter Otten
claire morandin wrote: > Thanks Peter, true I did not realize that ercc_contigs is empty, but I am > not sure how to "populate" the dictionary if I only have one column for > the value but no key You could use a "dummy value" ercc_contigs = {} for line in open('Faq_ERCC_contigs_name.txt'): g

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Steven D'Aprano
On Sun, 09 Jun 2013 19:16:06 +1000, Cameron Simpson wrote: > If he's lucky the UnicodeEncodeError occurred while trying to print an > error message, That's not what happens at the interactive console: py> assert os.path.exists('Ж1') Traceback (most recent call last): File "", line 1, in Ass

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Steven D'Aprano
On Sun, 09 Jun 2013 02:00:46 -0700, Νικόλαος Κούρας wrote: > Steven wrote: >>> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >>> values up to 256? > >>Because then how do you tell when you need one byte, and when you need >>two? If you read two bytes, and see 0x4C 0xFA, does

Re: I used defaultdic to store some variables but the output is blank

2013-06-09 Thread claire morandin
Thanks Peter, true I did not realize that ercc_contigs is empty, but I am not sure how to "populate" the dictionary if I only have one column for the value but no key -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Andreas Perstinger
On 09.06.2013 11:38, Νικόλαος Κούρας wrote: s = 'α' s = s.encode('iso-8859-7').decode('utf-8') print( s ) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data Why this error? because 'a' ordinal value > 127 ? >>> s = 'α' >>> s.encode('iso-8859-7') b'

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
Please and tell me that this actually can be solved. Iam willing to try anything for 'files.py' to load propelry. Every thign works as expected in my webiste, have manages to correct pelatologio.poy and koukos.py. This is the last thing the webiste needs, that is files.py to load so users can gr

Re: A few questiosn about encoding

2013-06-09 Thread Fábio Santos
On 9 Jun 2013 11:49, "Νικόλαος Κούρας" wrote: > > A few questiosn about encoding please: > > >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for > >> values up to 256? > > >Because then how do you tell when you need one byte, and when you need > >two? If you read two bytes, and

Re: I used defaultdic to store some variables but the output is blank

2013-06-09 Thread Peter Otten
claire morandin wrote: > I have the following script which does not return anything, no apparent > mistake but my output file is empty.I am just trying to extract some > decimal number from a file according to their names which are in another > file. from collections import defaultdict import nump

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Steven D'Aprano
On Sun, 09 Jun 2013 10:55:43 +0200, Lele Gaifax wrote: > Steven D'Aprano writes: > >> On Sat, 08 Jun 2013 22:09:57 -0700, nagia.retsina wrote: >> >>> chr('A') would give me the mapping of this char, the number 65 while >>> ord(65) would output the char 'A' likewise. >> >> Correct. Python uses Un

Re: how to detect the character encoding in a web page ?

2013-06-09 Thread iMath
在 2012年12月24日星期一UTC+8上午8时34分47秒,iMath写道: > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ here is one thread that can help me understanding my code http://stackoverflow.com/questions/17001407/how-to-detect-the-character-encoding-of-a-we

Re: how to detect the character encoding in a web page ?

2013-06-09 Thread iMath
在 2012年12月24日星期一UTC+8上午8时34分47秒,iMath写道: > how to detect the character encoding in a web page ? > > such as this page > > > > http://python.org/ Finally ,I found by using PyQt’s QtextStream , QTextCodec and chardet ,we can get a web page code more securely even for this bad page http://ww

Re: Errin when executing a cgi script that sets a cookie in the browser

2013-06-09 Thread Νικόλαος Κούρας
Τη Κυριακή, 9 Ιουνίου 2013 8:27:53 π.μ. UTC+3, ο χρήστης nagia@gmail.com έγραψε: > Trying > > > > yum install dos2unix > > > > and > > > > root@nikos [/home/nikos/www/cgi-bin]# dos2unix koukos.py > > dos2unix: converting file koukos.py to UNIX format ... > > > > > > Then brows

A few questiosn about encoding

2013-06-09 Thread Νικόλαος Κούρας
A few questiosn about encoding please: >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >> values up to 256? >Because then how do you tell when you need one byte, and when you need >two? If you read two bytes, and see 0x4C 0xFA, does that mean two >characters, with ordin

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
I k nwo i have been a pain in the ass these days but this is the lats explanation i want from you, just to understand it completely. >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >> values up to 256? >Because then how do you tell when you need one byte, and when you ne

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
Τη Κυριακή, 9 Ιουνίου 2013 12:14:12 μ.μ. UTC+3, ο χρήστης Νικόλαος Κούρας έγραψε: > Τη Κυριακή, 9 Ιουνίου 2013 11:15:07 π.μ. UTC+3, ο χρήστης Steven D'Aprano > έγραψε: > > > > > Please try this: log into the Linux server, and then start up a Python > > > > > import os, sys > > > print(sy

I used defaultdic to store some variables but the output is blank

2013-06-09 Thread claire morandin
I have the following script which does not return anything, no apparent mistake but my output file is empty.I am just trying to extract some decimal number from a file according to their names which are in another file. from collections import defaultdict import numpy as np [code]ercc_contigs=

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
Τη Κυριακή, 9 Ιουνίου 2013 12:20:58 μ.μ. UTC+3, ο χρήστης Lele Gaifax έγραψε: > > How about a string i wonder? > > s = "νίκος" > > what_are these_bytes = s.encode('iso-8869-7').encode(utf-8') > Ignoring the usual syntax error, this is just a variant of the code I > posted: "s.encode('iso-8869-

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
Τη Κυριακή, 9 Ιουνίου 2013 12:12:36 μ.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: > On 09Jun2013 02:00, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= > wrote: > > | Steven wrote: > > | >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for > > | >> values up to 256? > > | > >

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Lele Gaifax
Νικόλαος Κούρας writes: > Τη Κυριακή, 9 Ιουνίου 2013 11:55:43 π.μ. UTC+3, ο χρήστης Lele Gaifax έγραψε: >> Uhm, no: "encode" transforms a Unicode string into an array of bytes, >> "decode" does the opposite transformation. You cannot do the former on >> an "arbitrary" array of bytes: >> >> >

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Cameron Simpson
On 09Jun2013 08:15, Steven D'Aprano wrote: | On Sun, 09 Jun 2013 00:00:53 -0700, nagia.retsina wrote: | > path = b'/home/nikos/public_html/data/apps/' | > files = os.listdir( path ) | > | > for filename in files: | > # Compute 'path/to/filename' | > filepath_bytes = path + filename | >

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
Τη Κυριακή, 9 Ιουνίου 2013 11:15:07 π.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > Please try this: log into the Linux server, and then start up a Python > import os, sys > print(sys.version) > s = ('\N{GREEK SMALL LETTER ALPHA}\N{GREEK SMALL LETTER BETA}' > '\N{GREEK SMALL LETTER GAMMA

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Cameron Simpson
On 09Jun2013 02:00, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= wrote: | Steven wrote: | >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for | >> values up to 256? | | >Because then how do you tell when you need one byte, and when you need | >two? If you read two bytes, and se

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
Τη Κυριακή, 9 Ιουνίου 2013 11:55:43 π.μ. UTC+3, ο χρήστης Lele Gaifax έγραψε: > Steven D'Aprano writes: > > > > > On Sat, 08 Jun 2013 22:09:57 -0700, nagia.retsina wrote: > > > > > >> chr('A') would give me the mapping of this char, the number 65 while > > >> ord(65) would output the char 'A

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
Τη Κυριακή, 9 Ιουνίου 2013 11:02:48 π.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: > In this scenario, really it is the Terminal program (eg Putty) which > cares about text (what you type, and what gets displayed). It is > because of mismatches between your Terminal local settings and the > encodi

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
Steven wrote: >> Since 1 byte can hold up to 256 chars, why not utf-8 use 1-byte for >> values up to 256? >Because then how do you tell when you need one byte, and when you need >two? If you read two bytes, and see 0x4C 0xFA, does that mean two >characters, with ordinal values 0x4C and 0xFA, o

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Lele Gaifax
Steven D'Aprano writes: > On Sat, 08 Jun 2013 22:09:57 -0700, nagia.retsina wrote: > >> chr('A') would give me the mapping of this char, the number 65 while >> ord(65) would output the char 'A' likewise. > > Correct. Python uses Unicode, where code-point 65 ("ordinal value 65") > means letter "A

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Steven D'Aprano
On Sun, 09 Jun 2013 00:00:53 -0700, nagia.retsina wrote: > path = b'/home/nikos/public_html/data/apps/' > files = os.listdir( path ) > > for filename in files: > # Compute 'path/to/filename' > filepath_bytes = path + filename > for encoding in ('utf-8', 'iso-8859-7', 'latin-1'):

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Νικόλαος Κούρας
I'm sorry posted by mistake unnessary code: here is the correct one that prodiuced the above error: # # Collect directory and its filenames as bytes path = b'/home/nikos/public_html/data/apps/' files = os.listdir( path ) for filename in fi

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Cameron Simpson
On 09Jun2013 06:25, Steven D'Aprano wrote: | [... heaps of useful explaination ...] | > When locale to linux system is set to utf-8 that would mean that the | > linux applications, should try to encode string into hdd by using | > system's default encoding to utf-8 nad read them back from bytes

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread nagia . retsina
Thanks Stevn, i ll read them in a bit. When i read them can you perhaps tell me whats wrong and ima still getting decode issues? [CODE] # = # If user downloaded a file, thank the user