Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42037 > unrolled thread

Altering 2 statements from Python 2.6 => 3.2

Started byΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
First post2013-03-27 13:18 -0700
Last post2013-03-27 19:16 -0700
Articles 9 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Altering 2 statements from Python 2.6 => 3.2 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 13:18 -0700
    Re: Altering 2 statements from Python 2.6 => 3.2 Chris Angelico <rosuav@gmail.com> - 2013-03-28 09:55 +1100
      Re: Altering 2 statements from Python 2.6 => 3.2 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 19:16 -0700
        Re: Altering 2 statements from Python 2.6 => 3.2 Chris Angelico <rosuav@gmail.com> - 2013-03-28 13:28 +1100
          Re: Altering 2 statements from Python 2.6 => 3.2 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 19:39 -0700
          Re: Altering 2 statements from Python 2.6 => 3.2 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 19:39 -0700
            Re: Altering 2 statements from Python 2.6 => 3.2 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 02:43 -0700
            Re: Altering 2 statements from Python 2.6 => 3.2 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-28 02:43 -0700
      Re: Altering 2 statements from Python 2.6 => 3.2 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-27 19:16 -0700

#42037 — Altering 2 statements from Python 2.6 => 3.2

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-27 13:18 -0700
SubjectAltering 2 statements from Python 2.6 => 3.2
Message-ID<73865aec-bee1-4aea-b8b4-28a4cad24473@googlegroups.com>
Hello folks,

With what do i need to replace:
-----------
print ( "Query Error: ", sys.exc_info()[1].excepinfo()[2] )
---------

and

----------
date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8')
----------
in Python3? because in 2.6 used to work but they dont in Pytho 3

thank you.

[toc] | [next] | [standalone]


#42047

FromChris Angelico <rosuav@gmail.com>
Date2013-03-28 09:55 +1100
Message-ID<mailman.3831.1364424914.2939.python-list@python.org>
In reply to#42037
On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8')

For a start, figure out what you're trying to do. I'm trying to get my
head around this line and I'm not getting anywhere. Is 'date' an
instance of datetime.date()? And whatever it is, why do you then
immediately rebind it? And why decode an arbitrary string using an
arbitrary encoding? And why.... never mind. Start here:

http://www.joelonsoftware.com/articles/Unicode.html

One of Python 3's big features is that it forces you to distinguish
text strings from binary ones.

ChrisA

[toc] | [prev] | [next] | [standalone]


#42055

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-27 19:16 -0700
Message-ID<c286bc08-33b0-4d54-8396-4c3a80cd49d3@googlegroups.com>
In reply to#42047
Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> > date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8')
> 
> 
> 
> For a start, figure out what you're trying to do. I'm trying to get my
> 
> head around this line and I'm not getting anywhere. Is 'date' an
> 
> instance of datetime.date()? And whatever it is, why do you then
> 
> immediately rebind it? And why decode an arbitrary string using an
> 
> arbitrary encoding? And why.... never mind. Start here:
> 
> 
> 
> http://www.joelonsoftware.com/articles/Unicode.html
> 
> 
> 
> One of Python 3's big features is that it forces you to distinguish
> 
> text strings from binary ones.
> 
> 
> 
> ChrisA


I had to use it like that in order for date to be appear correctly in greek otherwise it would seem like chinese.

So now you mena i dont have to decode anym ore and use it liek that?

date = date.strftime('%A, %e %b %Y').encode('utf8')

[toc] | [prev] | [next] | [standalone]


#42062

FromChris Angelico <rosuav@gmail.com>
Date2013-03-28 13:28 +1100
Message-ID<mailman.3836.1364437687.2939.python-list@python.org>
In reply to#42055
On Thu, Mar 28, 2013 at 1:16 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
>> On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
>>
>> > date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8')
>>
>>
>>
>> For a start, figure out what you're trying to do. I'm trying to get my
>>
>> head around this line and I'm not getting anywhere. Is 'date' an
>>
>> instance of datetime.date()? And whatever it is, why do you then
>>
>> immediately rebind it? And why decode an arbitrary string using an
>>
>> arbitrary encoding? And why.... never mind. Start here:
>>
>>
>>
>> http://www.joelonsoftware.com/articles/Unicode.html
>>
>>
>>
>> One of Python 3's big features is that it forces you to distinguish
>>
>> text strings from binary ones.
>>
>>
>>
>> ChrisA
>
>
> I had to use it like that in order for date to be appear correctly in greek otherwise it would seem like chinese.
>
> So now you mena i dont have to decode anym ore and use it liek that?
>
> date = date.strftime('%A, %e %b %Y').encode('utf8')

I mena, or mean, that you have to figure out what you're doing before
you try to figure out how to do it.

Or if you want help, then try providing context, like what data type 'date' is.

(And inb4 someone points out that "it's a date, duh". :) )

ChrisA

[toc] | [prev] | [next] | [standalone]


#42069

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-27 19:39 -0700
Message-ID<17e017f0-0ac5-4ee3-b1a9-255005e2dd45@googlegroups.com>
In reply to#42062
Τη Πέμπτη, 28 Μαρτίου 2013 4:28:04 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> On Thu, Mar 28, 2013 at 1:16 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> > Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> 
> >> On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> >>
> 
> >> > date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8')
> 
> >>
> 
> >>
> 
> >>
> 
> >> For a start, figure out what you're trying to do. I'm trying to get my
> 
> >>
> 
> >> head around this line and I'm not getting anywhere. Is 'date' an
> 
> >>
> 
> >> instance of datetime.date()? And whatever it is, why do you then
> 
> >>
> 
> >> immediately rebind it? And why decode an arbitrary string using an
> 
> >>
> 
> >> arbitrary encoding? And why.... never mind. Start here:
> 
> >>
> 
> >>
> 
> >>
> 
> >> http://www.joelonsoftware.com/articles/Unicode.html
> 
> >>
> 
> >>
> 
> >>
> 
> >> One of Python 3's big features is that it forces you to distinguish
> 
> >>
> 
> >> text strings from binary ones.
> 
> >>
> 
> >>
> 
> >>
> 
> >> ChrisA
> 
> >
> 
> >
> 
> > I had to use it like that in order for date to be appear correctly in greek otherwise it would seem like chinese.
> 
> >
> 
> > So now you mena i dont have to decode anym ore and use it liek that?
> 
> >
> 
> > date = date.strftime('%A, %e %b %Y').encode('utf8')
> 
> 
> 
> I mena, or mean, that you have to figure out what you're doing before
> 
> you try to figure out how to do it.
> 
> 
> 
> Or if you want help, then try providing context, like what data type 'date' is.

I'am just tryign to print the date with proper greek letters as it uses to work with Python v2.6

date gets calculated here:

date = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )

I'am not sure but i believe that the decode must be taken out in python 3.x because objexts returned in unicoide now, but i'am not sure.

[toc] | [prev] | [next] | [standalone]


#42070

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-27 19:39 -0700
Message-ID<mailman.3842.1364438381.2939.python-list@python.org>
In reply to#42062
Τη Πέμπτη, 28 Μαρτίου 2013 4:28:04 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> On Thu, Mar 28, 2013 at 1:16 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> > Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> 
> >> On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> >>
> 
> >> > date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8')
> 
> >>
> 
> >>
> 
> >>
> 
> >> For a start, figure out what you're trying to do. I'm trying to get my
> 
> >>
> 
> >> head around this line and I'm not getting anywhere. Is 'date' an
> 
> >>
> 
> >> instance of datetime.date()? And whatever it is, why do you then
> 
> >>
> 
> >> immediately rebind it? And why decode an arbitrary string using an
> 
> >>
> 
> >> arbitrary encoding? And why.... never mind. Start here:
> 
> >>
> 
> >>
> 
> >>
> 
> >> http://www.joelonsoftware.com/articles/Unicode.html
> 
> >>
> 
> >>
> 
> >>
> 
> >> One of Python 3's big features is that it forces you to distinguish
> 
> >>
> 
> >> text strings from binary ones.
> 
> >>
> 
> >>
> 
> >>
> 
> >> ChrisA
> 
> >
> 
> >
> 
> > I had to use it like that in order for date to be appear correctly in greek otherwise it would seem like chinese.
> 
> >
> 
> > So now you mena i dont have to decode anym ore and use it liek that?
> 
> >
> 
> > date = date.strftime('%A, %e %b %Y').encode('utf8')
> 
> 
> 
> I mena, or mean, that you have to figure out what you're doing before
> 
> you try to figure out how to do it.
> 
> 
> 
> Or if you want help, then try providing context, like what data type 'date' is.

I'am just tryign to print the date with proper greek letters as it uses to work with Python v2.6

date gets calculated here:

date = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )

I'am not sure but i believe that the decode must be taken out in python 3.x because objexts returned in unicoide now, but i'am not sure.

[toc] | [prev] | [next] | [standalone]


#42106

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-28 02:43 -0700
Message-ID<340ae7c2-74ca-4167-9bc3-29f232e2cd9e@googlegroups.com>
In reply to#42070
I'am just tryign to print the date with proper greek letters as it uses to work with Python v2.6 

date gets calculated here: 

date = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' ) 

I'am not sure but i believe that the decode must be taken out in python 3.x because objexts returned in unicoide now, but i'am not sure. 

[toc] | [prev] | [next] | [standalone]


#42109

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-28 02:43 -0700
Message-ID<mailman.3865.1364464432.2939.python-list@python.org>
In reply to#42070
I'am just tryign to print the date with proper greek letters as it uses to work with Python v2.6 

date gets calculated here: 

date = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' ) 

I'am not sure but i believe that the decode must be taken out in python 3.x because objexts returned in unicoide now, but i'am not sure. 

[toc] | [prev] | [next] | [standalone]


#42058

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-27 19:16 -0700
Message-ID<mailman.3833.1364436969.2939.python-list@python.org>
In reply to#42047
Τη Πέμπτη, 28 Μαρτίου 2013 12:55:11 π.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> On Thu, Mar 28, 2013 at 7:18 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> > date = date.strftime('%A, %e %b %Y').decode('cp1253').encode('utf8')
> 
> 
> 
> For a start, figure out what you're trying to do. I'm trying to get my
> 
> head around this line and I'm not getting anywhere. Is 'date' an
> 
> instance of datetime.date()? And whatever it is, why do you then
> 
> immediately rebind it? And why decode an arbitrary string using an
> 
> arbitrary encoding? And why.... never mind. Start here:
> 
> 
> 
> http://www.joelonsoftware.com/articles/Unicode.html
> 
> 
> 
> One of Python 3's big features is that it forces you to distinguish
> 
> text strings from binary ones.
> 
> 
> 
> ChrisA


I had to use it like that in order for date to be appear correctly in greek otherwise it would seem like chinese.

So now you mena i dont have to decode anym ore and use it liek that?

date = date.strftime('%A, %e %b %Y').encode('utf8')

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web