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


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

An error when i switched from python v2.6.6 => v3.2.3

Started byΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
First post2013-03-07 00:18 -0800
Last post2013-03-07 13:50 -0500
Articles 20 on this page of 80 — 14 participants

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


Contents

  An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 00:18 -0800
    Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:06 -0800
      Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 03:27 -0800
        Re: An error when i switched from python v2.6.6 => v3.2.3 "Michael Ross" <gmx@ross.cx> - 2013-03-07 12:51 +0100
          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 04:25 -0800
            Re: An error when i switched from python v2.6.6 => v3.2.3 "Michael Ross" <gmx@ross.cx> - 2013-03-07 14:06 +0100
              Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 05:22 -0800
                Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 00:43 +1100
                  Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 05:56 -0800
                    Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 01:01 +1100
                      Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:11 -0800
                        Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:13 -0800
                          Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 01:17 +1100
                            Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:34 -0800
                              Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 01:37 +1100
                                Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:44 -0800
                                  Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 01:48 +1100
                                Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:44 -0800
                            Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:34 -0800
                        Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:13 -0800
                        Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 01:16 +1100
                      Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:11 -0800
                  Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 05:56 -0800
              Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 05:22 -0800
          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 04:25 -0800
    Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:50 -0800
      Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 06:52 -0800
      Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 07:01 -0800
        Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 02:13 +1100
          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 07:26 -0800
            Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 02:33 +1100
              Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 07:57 -0800
                Re: An error when i switched from python v2.6.6 => v3.2.3 rh <richard_hubbe11@lavabit.com> - 2013-03-07 10:51 -0800
                Re: An error when i switched from python v2.6.6 => v3.2.3 Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-07 13:57 -0500
                Re: An error when i switched from python v2.6.6 => v3.2.3 Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-07 14:36 -0500
                  Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 12:04 -0800
                    Re: An error when i switched from python v2.6.6 => v3.2.3 Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-07 13:15 -0700
                      Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 16:57 -0800
                        Re: An error when i switched from python v2.6.6 => v3.2.3 Vito De Tullio <vito.detullio@gmail.com> - 2013-03-08 04:55 +0100
                          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 22:54 -0800
                          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 22:54 -0800
                          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 22:56 -0800
                            Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-08 18:01 +1100
                              Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 02:51 -0800
                              Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 02:51 -0800
                          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 22:56 -0800
                          Re: An error when i switched from python v2.6.6 => v3.2.3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-08 18:54 +0000
                            Re: An error when i switched from python v2.6.6 => v3.2.3 info@cravendot.gr - 2013-03-08 11:19 -0800
                              Re: An error when i switched from python v2.6.6 => v3.2.3 Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-08 13:01 -0700
                                Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 12:31 -0800
                                  Re: An error when i switched from python v2.6.6 => v3.2.3 Chris Angelico <rosuav@gmail.com> - 2013-03-09 08:37 +1100
                                    Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 19:18 -0800
                                      Re: An error when i switched from python v2.6.6 => v3.2.3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-09 03:27 +0000
                                      Re: An error when i switched from python v2.6.6 => v3.2.3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-09 05:05 +0000
                                        Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 23:56 -0800
                                          Re: An error when i switched from python v2.6.6 => v3.2.3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-09 12:43 +0000
                                            Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-09 06:16 -0800
                                            Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-09 06:16 -0800
                                              Re: An error when i switched from python v2.6.6 => v3.2.3 rusi <rustompmody@gmail.com> - 2013-03-09 07:20 -0800
                                    Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 19:18 -0800
                                  Re: An error when i switched from python v2.6.6 => v3.2.3 Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-08 17:26 -0700
                                    Re: An error when i switched from python v2.6.6 => v3.2.3 nagia.retsina@gmail.com - 2013-03-08 19:15 -0800
                                    Re: An error when i switched from python v2.6.6 => v3.2.3 nagia.retsina@gmail.com - 2013-03-08 19:15 -0800
                                Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 12:31 -0800
                              Re: An error when i switched from python v2.6.6 => v3.2.3 Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-08 13:04 -0700
                            Re: An error when i switched from python v2.6.6 => v3.2.3 nagia.retsina@gmail.com - 2013-03-08 12:54 -0800
                              Re: An error when i switched from python v2.6.6 => v3.2.3 emile <emile@fenx.com> - 2013-03-08 14:13 -0800
                              Re: An error when i switched from python v2.6.6 => v3.2.3 Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-08 17:18 -0700
                                Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 19:17 -0800
                                  Re: An error when i switched from python v2.6.6 => v3.2.3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-09 03:33 +0000
                                Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-08 19:17 -0800
                      Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 16:57 -0800
                  Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 12:04 -0800
              Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 07:57 -0800
          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 07:26 -0800
        Re: An error when i switched from python v2.6.6 => v3.2.3 John Gordon <gordon@panix.com> - 2013-03-07 15:55 +0000
          Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 08:00 -0800
            Re: An error when i switched from python v2.6.6 => v3.2.3 Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 08:22 -0800
              Re: An error when i switched from python v2.6.6 => v3.2.3 Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-07 12:41 -0500
              Re: An error when i switched from python v2.6.6 => v3.2.3 Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-07 13:50 -0500

Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →


#40772

FromChris Angelico <rosuav@gmail.com>
Date2013-03-08 01:16 +1100
Message-ID<mailman.3023.1362665769.2939.python-list@python.org>
In reply to#40768
On Fri, Mar 8, 2013 at 1:11 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> Τη Πέμπτη, 7 Μαρτίου 2013 4:01:13 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
>
>> You are panicking about specific problems. Take a deep breath, take a
>>
>> step back, and look at what's going on. If you've really been trying
>>
>> for three days to make this work, it won't cost you much more to spend
>>
>> three minutes polishing your email before you send it... or those same
>>
>> three minutes reading the docs and finding what you want.
>
> Iam willing to read some document that describe what iam dealing with, please provid eme a link and aill read it....

http://www.google.com/

> I think its an OS issue and not statment issue.

I think it's a pebkac issue.

> iam starting to hink that maybe
>
> python metritis.py > /data/files/htmltemp
>
> might work. i will try this now as we speak.lets hope for God;s sake it will work!

Tip: Next time, try it first, THEN post. This is not IRC. You don't
need to tell us that you're trying, and that you're panicking still
further.

ChrisA

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


#40769

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 06:11 -0800
Message-ID<mailman.3021.1362665472.2939.python-list@python.org>
In reply to#40767
Τη Πέμπτη, 7 Μαρτίου 2013 4:01:13 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:

> You are panicking about specific problems. Take a deep breath, take a
> 
> step back, and look at what's going on. If you've really been trying
> 
> for three days to make this work, it won't cost you much more to spend
> 
> three minutes polishing your email before you send it... or those same
> 
> three minutes reading the docs and finding what you want.

Iam willing to read some document that describe what iam dealing with, please provid eme a link and aill read it....

I think its an OS issue and not statment issue.

iam starting to hink that maybe

python metritis.py > /data/files/htmltemp

might work. i will try this now as we speak.lets hope for God;s sake it will work!

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


#40766

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 05:56 -0800
Message-ID<mailman.3019.1362664616.2939.python-list@python.org>
In reply to#40764
But iam tryign dayd for this i even tryign to chnage my 3 script to python v3.2.3 just to get subprocess up and running

all the above fail:

htmldata = os.system("python metrites.py '/data/files/htmltemp'")

How can i tell system to send metritis.py's output to a temporary file called htmltemp so in the next step i can do what iam trying 3 days now to do:

template = htmldata + counter

os.system is very vague while i need specific help with this.
if you provide me a link that describes my case of things i';; for sure read it.

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


#40762

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 05:22 -0800
Message-ID<mailman.3017.1362662582.2939.python-list@python.org>
In reply to#40759
Please tell me at least if i ahve any syntax error in this line:

htmldata = os.system('/usr/bin/python ./metrites.py /data/files/htmltemp')

please man its essential for my website to work otherwise 3 scripts i wrote would not be able to produce proper html output that then i need to append a string after them. her si what i want to do:

	if htmlpage.endswith('.html'):
		f = open( "/home/nikos/www/" + htmlpage )
		htmldata = f.read()
	elif htmlpage.endswith('.py'):
		htmldata = os.system('/usr/bin/python ./metrites.py /data/files/htmltemp')
		
		
	counter = ''' <center><a href="mailto:support@superhost.gr"> <img src="/data/images/mail.png"> </a>
		      <center><table border=2 cellpadding=2 bgcolor=black>
				<td><font color=lime>Αριθμός Επισκεπτών</td>
				<td><a href="http://superhost.gr/?show=stats"><font color=cyan> %d </td>
		  ''' % data[0]
		
		
	template = htmldata + counter
	print( template )

======================

Please just that i like to do it myself ut i cant, i wont ask anyhting else.

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


#40826

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 04:25 -0800
Message-ID<mailman.3057.1362690962.2939.python-list@python.org>
In reply to#40751
Τη Πέμπτη, 7 Μαρτίου 2013 1:51:42 μ.μ. UTC+2, ο χρήστης Michael Ross έγραψε:
> On Thu, 07 Mar 2013 12:27:03 +0100, Νίκος Γκρ33κ <nikos.gr33k@gmail.com>  
> 
> wrote:
> 
> 
> 
> > Τη Πέμπτη, 7 Μαρτίου 2013 11:06:27 π.μ. UTC+2, ο χρήστης Νίκος Γκρ33κ  
> 
> > έγραψε:
> 
> >> Any ideas about the error please?
> 
> >>
> 
> >>
> 
> >>
> 
> >> I can assure you all the statemnt are correct ebcause they work in  
> 
> >> python v2.6.6
> 
> >
> 
> > can someone help this issue so my webiste will get back on working plz?
> 
> 
> 
> MySQLdb is python 2 only.
> 
> "MySQL-3.23 through 5.0 and Python-2.3 through 2.7 are currently  
> 
> supported. Python-3.0 will be supported in a future release."
> 
> 
> 
> Maybe try this one:
> 
> https://pypi.python.org/pypi/mysql-connector-python/1.0.9
> 
> 
> 
> Alternatively,
> 
> forget about subprocess.check_output,
> 
> call your metrites.py with os.system('python metrites.py some-temp-file')
> 
> and have it write its output to some-temp-file,
> 
> and read some-temp-file back into your template?

Yes its better for me to give upon python3 for the moment being, because all that hassle was for makeing the subprocess command run.

Now i just followed your advice and tried:

	elif htmlpage.endswith('.py'):
		htmldata = os.system('/usr/bin/python ./metrites.py /data/files/htmltemp')

but produced error tells me that:

template undefined, htmldata = -1, counter = ' <center><a href="mailto:support@superhost.gr"> ...st.gr/?show=stats"><font color=cyan> 0 </td>\n\t\t '

whay htmldata reeturn the value '-1' when os.sytem is executed?

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


#40780

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 06:50 -0800
Message-ID<622d4a2d-0014-4254-b211-c8fd66510f74@googlegroups.com>
In reply to#40717
		os.system( 'python metrites.py > htmltemp' )
		f = open( htmltemp )
		htmldata = f.read()	

gives:

f undefined, builtin open = <built-in function open>, temp = '/home/nikos/www/data/private/htmltemp'
<type 'exceptions.IOError'>: [Errno 2] ��� ������� ������ ������ � ���������: '/home/nikos/www/data/private/htmltemp' 
      args = (2, '\xc4\xe5\xed \xf5\xf0\xdc\xf1\xf7\xe5\xe9 \xf4\xdd\xf4\xef\xe9\xef \xe1\xf1\xf7\xe5\xdf\xef \xde \xea\xe1\xf4\xdc\xeb\xef\xe3\xef\xf2') 
      errno = 2 
      filename = '/home/nikos/www/data/private/htmltemp' 
      message = '' 
      strerror = '\xc4\xe5\xed \xf5\xf0\xdc\xf1\xf7\xe5\xe9 \xf4\xdd\xf4\xef\xe9\xef \xe1\xf1\xf7\xe5\xdf\xef \xde \xea\xe1\xf4\xdc\xeb\xef\xe3\xef\xf2'

Very weird!

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


#40781

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 06:52 -0800
Message-ID<d6516321-1a31-47e1-bc85-978bffe7f017@googlegroups.com>
In reply to#40780
Why f gives back an error and doesnt open the filename that i give it as anvariable successfully?

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


#40782

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 07:01 -0800
Message-ID<c2a09443-3c74-477b-af9f-a6f3473ebe88@googlegroups.com>
In reply to#40780
Τη Πέμπτη, 7 Μαρτίου 2013 4:50:34 μ.μ. UTC+2, ο χρήστης Νίκος Γκρ33κ έγραψε:
> os.system( 'python metrites.py > htmltemp' )

That is wrong now i realize, it takes htmltemp as the filename where what i need is to take it htmltemp's varibales value.

Switching back to:

		os.system( 'python metrites.py > %s' ) % htmltemp
		f = open( htmltemp )
		htmldata = f.read()	

but still donse see what iam doing wrong.....

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


#40783

FromChris Angelico <rosuav@gmail.com>
Date2013-03-08 02:13 +1100
Message-ID<mailman.3029.1362669207.2939.python-list@python.org>
In reply to#40782
On Fri, Mar 8, 2013 at 2:01 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> os.system( 'python metrites.py > %s' ) % htmltemp

Manually step through what this line should do. Follow the exact same
rules Python will follow in evaluating this expression.

http://docs.python.org/2/reference/expressions.html#operator-precedence
http://docs.python.org/3/reference/expressions.html#operator-precedence

As you'll see from footnote 8 or 5 (depending on which version of the
docs), your percent operator is the same one listed in the table as a
division operator.

Now. Go through that expression, step by step. Walk through everything
the Python interpreter does. Figure out exactly what happens first,
second, third. Figure out when your percent operator gets handled.
Then you'll know what's wrong with that line of code.

You'll also gain a very useful understanding of Python, and more
generally of the way most high level languages parse expressions.

ChrisA

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


#40786

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 07:26 -0800
Message-ID<e63776b9-ba74-4349-9538-7fe95323d4be@googlegroups.com>
In reply to#40783
Τη Πέμπτη, 7 Μαρτίου 2013 5:13:24 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> On Fri, Mar 8, 2013 at 2:01 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> > os.system( 'python metrites.py > %s' ) % htmltemp
> 
> 
> 
> Manually step through what this line should do. Follow the exact same
> 
> rules Python will follow in evaluating this expression.
> 
> 
> 
> http://docs.python.org/2/reference/expressions.html#operator-precedence
> 
> http://docs.python.org/3/reference/expressions.html#operator-precedence
> 
> 
> 
> As you'll see from footnote 8 or 5 (depending on which version of the
> 
> docs), your percent operator is the same one listed in the table as a
> 
> division operator.
> 
> 
> 
> Now. Go through that expression, step by step. Walk through everything
> 
> the Python interpreter does. Figure out exactly what happens first,
> 
> second, third. Figure out when your percent operator gets handled.
> 
> Then you'll know what's wrong with that line of code.
> 
> 
> 
> You'll also gain a very useful understanding of Python, and more
> 
> generally of the way most high level languages parse expressions.
> 
> 
> 
> ChrisA

I'am sorry to say i cant figure this out :(
please enlight me.

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


#40788

FromChris Angelico <rosuav@gmail.com>
Date2013-03-08 02:33 +1100
Message-ID<mailman.3033.1362670392.2939.python-list@python.org>
In reply to#40786
On Fri, Mar 8, 2013 at 2:26 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> Τη Πέμπτη, 7 Μαρτίου 2013 5:13:24 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
>> On Fri, Mar 8, 2013 at 2:01 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
>>
>> > os.system( 'python metrites.py > %s' ) % htmltemp
>>
>>
>>
>> Manually step through what this line should do. Follow the exact same
>>
>> rules Python will follow in evaluating this expression.
>>
>>
>>
>> http://docs.python.org/2/reference/expressions.html#operator-precedence
>>
>> http://docs.python.org/3/reference/expressions.html#operator-precedence
>>
>>
>>
>> As you'll see from footnote 8 or 5 (depending on which version of the
>>
>> docs), your percent operator is the same one listed in the table as a
>>
>> division operator.
>>
>>
>>
>> Now. Go through that expression, step by step. Walk through everything
>>
>> the Python interpreter does. Figure out exactly what happens first,
>>
>> second, third. Figure out when your percent operator gets handled.
>>
>> Then you'll know what's wrong with that line of code.
>>
>>
>>
>> You'll also gain a very useful understanding of Python, and more
>>
>> generally of the way most high level languages parse expressions.
>>
>>
>>
>> ChrisA
>
> I'am sorry to say i cant figure this out :(
> please enlight me.

You can figure it out, but it will take some effort. I will not
enlighten you further. The documentation is all there; the answers are
available.

ChrisA

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


#40791

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 07:57 -0800
Message-ID<33f153b4-4f54-429a-a92d-387b679bf758@googlegroups.com>
In reply to#40788
Τη Πέμπτη, 7 Μαρτίου 2013 5:33:10 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:

> You can figure it out, but it will take some effort. I will not
> 
> enlighten you further. The documentation is all there; the answers are
> 
> available.

I found it! I have placed 'htmltemp' within the os.system() call. Otherwise, os.system() returns a return value (int) which python then tries to concatenate with htmltemp (string).

os.system( 'python metrites.py > %s' % htmltemp )

:-)

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


#40809

Fromrh <richard_hubbe11@lavabit.com>
Date2013-03-07 10:51 -0800
Message-ID<mailman.3044.1362682281.2939.python-list@python.org>
In reply to#40791
On Thu, 7 Mar 2013 07:57:33 -0800 (PST)
Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> I found it! I have placed 'htmltemp' within the os.system() call.
> Otherwise, os.system() returns a return value (int) which python then
> tries to concatenate with htmltemp (string).
> 
> os.system( 'python metrites.py > %s' % htmltemp )

Can also do 
sterrs = 'errorsout'
os.system( 'python metrites.py > {0} 2> {1}'.format(htmltemp,sterrs))

It's more 3ish, or 3ist or 3like.
> 
> :-)

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


#40810

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2013-03-07 13:57 -0500
Message-ID<mailman.3045.1362682642.2939.python-list@python.org>
In reply to#40791

[Multipart message — attachments visible in raw view] — view raw

On Thu, Mar 7, 2013 at 1:51 PM, rh <richard_hubbe11@lavabit.com> wrote:

> On Thu, 7 Mar 2013 07:57:33 -0800 (PST)
> Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> >
> > I found it! I have placed 'htmltemp' within the os.system() call.
> > Otherwise, os.system() returns a return value (int) which python then
> > tries to concatenate with htmltemp (string).
> >
> > os.system( 'python metrites.py > %s' % htmltemp )
>
> Can also do
> sterrs = 'errorsout'
> os.system( 'python metrites.py > {0} 2> {1}'.format(htmltemp,sterrs))
>
> It's more 3ish, or 3ist or 3like.
> >
> > :-)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

The content type situation is discussed here
http://stackoverflow.com/questions/9145517/executing-a-python-script-in-apache2

-- 
Joel Goldstick
http://joelgoldstick.com

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


#40814

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2013-03-07 14:36 -0500
Message-ID<mailman.3048.1362684995.2939.python-list@python.org>
In reply to#40791

[Multipart message — attachments visible in raw view] — view raw

On Thu, Mar 7, 2013 at 1:57 PM, Joel Goldstick <joel.goldstick@gmail.com>wrote:

>
>
>
> On Thu, Mar 7, 2013 at 1:51 PM, rh <richard_hubbe11@lavabit.com> wrote:
>
>> On Thu, 7 Mar 2013 07:57:33 -0800 (PST)
>> Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
>> >
>> > I found it! I have placed 'htmltemp' within the os.system() call.
>> > Otherwise, os.system() returns a return value (int) which python then
>> > tries to concatenate with htmltemp (string).
>> >
>> > os.system( 'python metrites.py > %s' % htmltemp )
>>
>> Can also do
>> sterrs = 'errorsout'
>> os.system( 'python metrites.py > {0} 2> {1}'.format(htmltemp,sterrs))
>>
>> It's more 3ish, or 3ist or 3like.
>> >
>> > :-)
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
> The content type situation is discussed here
> http://stackoverflow.com/questions/9145517/executing-a-python-script-in-apache2
>
> --
> Joel Goldstick
> http://joelgoldstick.com
>


So, I see you fixed the problem.  How?

-- 
Joel Goldstick
http://joelgoldstick.com

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


#40815

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 12:04 -0800
Message-ID<0074be2d-1f52-4626-bf53-fd9591f16bf7@googlegroups.com>
In reply to#40814
Τη Πέμπτη, 7 Μαρτίου 2013 9:36:33 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε:

>  So, I see you fixed the problem.  How?

Apart from appearing ugly its not causing any more trouble(other than some issues that i have fixed), so i will just d:

        os.system( 'python %s > %s' % (htmlpage, temp) )
        f = open( temp )
        htmldata = f.read()
        htmldata = htmldata.replace( 'Content-type: text/html; charset=utf-8', '' )

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


#40817

FromIan Kelly <ian.g.kelly@gmail.com>
Date2013-03-07 13:15 -0700
Message-ID<mailman.3050.1362687355.2939.python-list@python.org>
In reply to#40815
On Thu, Mar 7, 2013 at 1:04 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> Τη Πέμπτη, 7 Μαρτίου 2013 9:36:33 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε:
>
>>  So, I see you fixed the problem.  How?
>
> Apart from appearing ugly its not causing any more trouble(other than some issues that i have fixed), so i will just d:
>
>         os.system( 'python %s > %s' % (htmlpage, temp) )
>         f = open( temp )
>         htmldata = f.read()
>         htmldata = htmldata.replace( 'Content-type: text/html; charset=utf-8', '' )

If htmlpage is being pulled from the HTTP request as I think it is,
then you have a code injection vulnerability here.  Think what could
happen if htmlpage were something like this:

-c ''; rm -rf /; oops.py

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


#40839

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 16:57 -0800
Message-ID<98cd9065-94b0-4fb6-b2fd-6ed96880242d@googlegroups.com>
In reply to#40817
Τη Πέμπτη, 7 Μαρτίου 2013 10:15:11 μ.μ. UTC+2, ο χρήστης Ian έγραψε:
> On Thu, Mar 7, 2013 at 1:04 PM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 
> > Τη Πέμπτη, 7 Μαρτίου 2013 9:36:33 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε:
> 
> >
> 
> >>  So, I see you fixed the problem.  How?
> 
> >
> 
> > Apart from appearing ugly its not causing any more trouble(other than some issues that i have fixed), so i will just d:
> 
> >
> 
> >         os.system( 'python %s > %s' % (htmlpage, temp) )
> 
> >         f = open( temp )
> 
> >         htmldata = f.read()
> 
> >         htmldata = htmldata.replace( 'Content-type: text/html; charset=utf-8', '' )
> 
> 
> 
> If htmlpage is being pulled from the HTTP request as I think it is,
> 
> then you have a code injection vulnerability here.  Think what could
> 
> happen if htmlpage were something like this:
> 
> 
> 
> -c ''; rm -rf /; oops.py

Yes its being pulled by http request!

But please try to do it, i dont think it will work!

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


#40842

FromVito De Tullio <vito.detullio@gmail.com>
Date2013-03-08 04:55 +0100
Message-ID<mailman.3066.1362714922.2939.python-list@python.org>
In reply to#40839
Νίκος Γκρ33κ wrote:

>> -c ''; rm -rf /; oops.py
> 
> Yes its being pulled by http request!
> 
> But please try to do it, i dont think it will work!

try yourself and tell us what happened

-- 
ZeD

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


#40846

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 22:54 -0800
Message-ID<2119e29e-da51-4c37-a0f5-26b70d907a53@googlegroups.com>
In reply to#40842
Τη Παρασκευή, 8 Μαρτίου 2013 5:55:07 π.μ. UTC+2, ο χρήστης Vito De Tullio έγραψε:
> Νίκος Γκρ33κ wrote:
> 
> 
> 
> >> -c ''; rm -rf /; oops.py
> 
> > 
> 
> > Yes its being pulled by http request!
> 
> > 
> 
> > But please try to do it, i dont think it will work!
> 
> 
> 
> try yourself and tell us what happened
> 
> 
> 
> -- 
> 
> ZeD

What command should i issue to try code injection?
someone tried it yesterday but it didnt work.

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


Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →

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


csiph-web