Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40717 > unrolled thread
| Started by | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| First post | 2013-03-07 00:18 -0800 |
| Last post | 2013-03-07 13:50 -0500 |
| Articles | 20 on this page of 80 — 14 participants |
Back to article view | Back to comp.lang.python
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 1 of 4 [1] 2 3 4 Next page →
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 00:18 -0800 |
| Subject | An error when i switched from python v2.6.6 => v3.2.3 |
| Message-ID | <8e17232e-5b24-4040-9215-c4bd89f34fa2@googlegroups.com> |
Today i switched to Python v3.2.3 on my remote web server at HostGator.
My cgi-script which it works at python v2.6.6 now produces theses errors:
--> -->
Traceback (most recent call last):
File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 171, in execute
r = self._query(query)
File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 330, in _query
rowcount = self._do_query(q)
File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 294, in _do_query
db.query(q)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s' at line 1")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "metrites.py", line 211, in <module>
cur.execute( '''SELECT hits FROM counters WHERE url = %s''', (htmlpage,) )
File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 184, in execute
self.errorhandler(self, exc, value)
File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass(errorvalue)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s' at line 1")
Even cursor.execute changes in python v3 ?
What are these errors about?
[toc] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 01:06 -0800 |
| Message-ID | <7bfe7117-d39d-48dc-9a6f-3d57484610a8@googlegroups.com> |
| In reply to | #40717 |
Any ideas about the error please? I can assure you all the statemnt are correct ebcause they work in python v2.6.6
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 03:27 -0800 |
| Message-ID | <213cf076-4163-44fd-a8b6-b25970da1bfa@googlegroups.com> |
| In reply to | #40723 |
Τη Πέμπτη, 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?
[toc] | [prev] | [next] | [standalone]
| From | "Michael Ross" <gmx@ross.cx> |
|---|---|
| Date | 2013-03-07 12:51 +0100 |
| Message-ID | <mailman.3009.1362657111.2939.python-list@python.org> |
| In reply to | #40749 |
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?
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 04:25 -0800 |
| Message-ID | <8a2af358-542c-45d3-b334-b4cb8f7cb7cf@googlegroups.com> |
| 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]
| From | "Michael Ross" <gmx@ross.cx> |
|---|---|
| Date | 2013-03-07 14:06 +0100 |
| Message-ID | <mailman.3015.1362661604.2939.python-list@python.org> |
| In reply to | #40757 |
On Thu, 07 Mar 2013 13:25:58 +0100, Νίκος Γκρ33κ <nikos.gr33k@gmail.com>
wrote:
> Τη Πέμπτη, 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?
Because
"On Unix, the return value is the exit status of the process encoded in
the format specified for wait()."
It's in the documentation for os.system.
Which you should have read before asking here.
You may not intend it like that,
but if you ask any and all errors here, you effectively ask the list to
develop the software for you.
Seriously this is beyond the scope of volunteer help for a commercial site.
I'm bailing out.
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 05:22 -0800 |
| Message-ID | <7b413998-2a6f-41cb-9e6d-7ba5b006bad4@googlegroups.com> |
| 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]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-08 00:43 +1100 |
| Message-ID | <mailman.3018.1362663841.2939.python-list@python.org> |
| In reply to | #40761 |
On Fri, Mar 8, 2013 at 12:22 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 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
Yes, there is. The variable name at the beginning is wrong. To
understand why, look at the documentation for os.system().
If it's essential for your web site, why not pay someone to do the work for you?
You want free support AND you're not willing to put effort into your
questions. That's a bad combination. The sloppiness of your writing,
coupled with a clear lack of preliminary research (eg checking the
docs), suggests that you do not value the end result; you expect
someone else to do everything, to wave a magic wand and voila, your
web site works. That isn't how the world works.
Quoting from http://www.catb.org/esr/faqs/smart-questions.html
> == Before you ask ==
> Prepare your question. Think it through. Hasty-sounding questions get
> hasty answers, or none at all. The more you do to demonstrate that having
> put thought and effort into solving your problem before seeking help, the
> more likely you are to actually get help.
...
> == Write in clear, grammatical, correctly-spelled language ==
> ... If you can't be bothered to do that, we can't be bothered to pay attention.
> Spend the extra effort to polish your language. It doesn't have to be stiff or
> formal - in fact, hacker culture values informal, slangy and humorous
> language used with precision. But it has to be precise; there has to be
> some indication that you're thinking and paying attention.
> ... if you write like a semi-literate boob you will very likely be ignored.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 05:56 -0800 |
| Message-ID | <12e70b6c-2dc6-4cb3-8731-a910a7621802@googlegroups.com> |
| 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]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-08 01:01 +1100 |
| Message-ID | <mailman.3020.1362664877.2939.python-list@python.org> |
| In reply to | #40765 |
On Fri, Mar 8, 2013 at 12:56 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> 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.
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.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 06:11 -0800 |
| Message-ID | <667bb7bc-2d76-435c-a8f6-f92fb383bd20@googlegroups.com> |
| 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]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 06:13 -0800 |
| Message-ID | <08b2cc58-b3ec-4f4e-bd0e-863a17e7569f@googlegroups.com> |
| In reply to | #40768 |
I made some progress!!! Now the htmldata's value its not -1 but 256!!!
look the error after trying this:
htmldata = os.system("python metrites.py > '/data/private/htmltemp'")
====================
template undefined, htmldata = 256, counter = ' <center><a href="mailto:support@superhost.gr"> ...st.gr/?show=stats"><font color=cyan> 0 </td>\n\t\t '
<type 'exceptions.TypeError'>: unsupported operand type(s) for +: 'int' and 'str'
args = ("unsupported operand type(s) for +: 'int' and 'str'",)
message = "unsupported operand type(s) for +: 'int' and 'str'"
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-08 01:17 +1100 |
| Message-ID | <mailman.3024.1362665850.2939.python-list@python.org> |
| In reply to | #40770 |
On Fri, Mar 8, 2013 at 1:13 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> I made some progress!!! Now the htmldata's value its not -1 but 256!!!
>
> look the error after trying this:
> htmldata = os.system("python metrites.py > '/data/private/htmltemp'")
Go check the docs for os.system() and understand why 'htmldata' is the
wrong name for its return value.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 06:34 -0800 |
| Message-ID | <4fea8c12-8f63-43b8-90cc-8bc57858c2ef@googlegroups.com> |
| In reply to | #40773 |
Docs doesn't explain that i just take looked at http://docs.python.org/2/library/os.html#os.system
I see that the return value of os.system its an indicator to as if the command inside os.system() returned successfully.
So i guess ill be needing somethign like this:
htmltemp = '/home/nikos/www/data/private/htmltemp'
if htmlpage.endswith('.html'):
f = open( "/home/nikos/www/" + htmlpage )
htmldata = f.read()
elif htmlpage.endswith('.py'):
os.system( 'python metrites.py > %s' ) % htmltemp
f = open( htmltemp )
htmldata = f.read()
template = htmldata + counter
==============
which i just tried and now iam receiving this:
<type 'exceptions.TypeError'>: unsupported operand type(s) for %: 'int' and 'str'
I'am very close to the solution now i cna feel it but please help a bit!
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-08 01:37 +1100 |
| Message-ID | <mailman.3026.1362667061.2939.python-list@python.org> |
| In reply to | #40774 |
On Fri, Mar 8, 2013 at 1:34 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote: > os.system( 'python metrites.py > %s' ) % htmltemp > > <type 'exceptions.TypeError'>: unsupported operand type(s) for %: 'int' and 'str' Simple parenthesis problem. Take a careful look at the line mentioned in the exception traceback (which you didn't share with us, but fortunately the error's pretty obvious) and see if you can find the problem. Hint: htmltemp is the str mentioned in the error. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 06:44 -0800 |
| Message-ID | <8a39a8d9-4afa-4b35-b2ef-e4f21f5925de@googlegroups.com> |
| In reply to | #40776 |
Τη Πέμπτη, 7 Μαρτίου 2013 4:37:31 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> On Fri, Mar 8, 2013 at 1:34 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
>
> > os.system( 'python metrites.py > %s' ) % htmltemp
>
> >
>
> > <type 'exceptions.TypeError'>: unsupported operand type(s) for %: 'int' and 'str'
>
>
>
> Simple parenthesis problem. Take a careful look at the line mentioned
>
> in the exception traceback (which you didn't share with us, but
>
> fortunately the error's pretty obvious) and see if you can find the
>
> problem.
> Hint: htmltemp is the str mentioned in the error.
/home/nikos/public_html/cgi-bin/metrites.py in ()
220 htmldata = f.read()
221 elif htmlpage.endswith('.py'):
222 os.system( 'python metrites.py > %s' ) % htmltemp
223 f = open( htmltemp )
224 htmldata = f.read()
os = <module 'os' from '/usr/lib64/python2.6/os.pyc'>, os.system = <built-in function system>, htmltemp = '/home/nikos/www/data/private/htmltemp'
<type 'exceptions.TypeError'>: unsupported operand type(s) for %: 'int' and 'str'
args = ("unsupported operand type(s) for %: 'int' and 'str'",)
message = "unsupported operand type(s) for %: 'int' and 'str'"
Τhis is the complete traceback iam reading it and reading it all over but i just dont *see* what it tries to tell me.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-08 01:48 +1100 |
| Message-ID | <mailman.3028.1362667714.2939.python-list@python.org> |
| In reply to | #40777 |
On Fri, Mar 8, 2013 at 1:44 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
> /home/nikos/public_html/cgi-bin/metrites.py in ()
> 220 htmldata = f.read()
> 221 elif htmlpage.endswith('.py'):
> 222 os.system( 'python metrites.py > %s' ) % htmltemp
> 223 f = open( htmltemp )
> 224 htmldata = f.read()
> os = <module 'os' from '/usr/lib64/python2.6/os.pyc'>, os.system = <built-in function system>, htmltemp = '/home/nikos/www/data/private/htmltemp'
> <type 'exceptions.TypeError'>: unsupported operand type(s) for %: 'int' and 'str'
> args = ("unsupported operand type(s) for %: 'int' and 'str'",)
> message = "unsupported operand type(s) for %: 'int' and 'str'"
>
> Τhis is the complete traceback iam reading it and reading it all over but i just dont *see* what it tries to tell me.
Try to get the default output from an exception, it's a lot more
useful. In any case, line 222 is the one being highlighted; you get a
couple of lines of context, but the middle one is where the error is.
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 06:44 -0800 |
| Message-ID | <mailman.3027.1362667491.2939.python-list@python.org> |
| In reply to | #40776 |
Τη Πέμπτη, 7 Μαρτίου 2013 4:37:31 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> On Fri, Mar 8, 2013 at 1:34 AM, Νίκος Γκρ33κ <nikos.gr33k@gmail.com> wrote:
>
> > os.system( 'python metrites.py > %s' ) % htmltemp
>
> >
>
> > <type 'exceptions.TypeError'>: unsupported operand type(s) for %: 'int' and 'str'
>
>
>
> Simple parenthesis problem. Take a careful look at the line mentioned
>
> in the exception traceback (which you didn't share with us, but
>
> fortunately the error's pretty obvious) and see if you can find the
>
> problem.
> Hint: htmltemp is the str mentioned in the error.
/home/nikos/public_html/cgi-bin/metrites.py in ()
220 htmldata = f.read()
221 elif htmlpage.endswith('.py'):
222 os.system( 'python metrites.py > %s' ) % htmltemp
223 f = open( htmltemp )
224 htmldata = f.read()
os = <module 'os' from '/usr/lib64/python2.6/os.pyc'>, os.system = <built-in function system>, htmltemp = '/home/nikos/www/data/private/htmltemp'
<type 'exceptions.TypeError'>: unsupported operand type(s) for %: 'int' and 'str'
args = ("unsupported operand type(s) for %: 'int' and 'str'",)
message = "unsupported operand type(s) for %: 'int' and 'str'"
Τhis is the complete traceback iam reading it and reading it all over but i just dont *see* what it tries to tell me.
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 06:34 -0800 |
| Message-ID | <mailman.3025.1362666855.2939.python-list@python.org> |
| In reply to | #40773 |
Docs doesn't explain that i just take looked at http://docs.python.org/2/library/os.html#os.system
I see that the return value of os.system its an indicator to as if the command inside os.system() returned successfully.
So i guess ill be needing somethign like this:
htmltemp = '/home/nikos/www/data/private/htmltemp'
if htmlpage.endswith('.html'):
f = open( "/home/nikos/www/" + htmlpage )
htmldata = f.read()
elif htmlpage.endswith('.py'):
os.system( 'python metrites.py > %s' ) % htmltemp
f = open( htmltemp )
htmldata = f.read()
template = htmldata + counter
==============
which i just tried and now iam receiving this:
<type 'exceptions.TypeError'>: unsupported operand type(s) for %: 'int' and 'str'
I'am very close to the solution now i cna feel it but please help a bit!
[toc] | [prev] | [next] | [standalone]
| From | Νίκος Γκρ33κ <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2013-03-07 06:13 -0800 |
| Message-ID | <mailman.3022.1362665590.2939.python-list@python.org> |
| In reply to | #40768 |
I made some progress!!! Now the htmldata's value its not -1 but 256!!!
look the error after trying this:
htmldata = os.system("python metrites.py > '/data/private/htmltemp'")
====================
template undefined, htmldata = 256, counter = ' <center><a href="mailto:support@superhost.gr"> ...st.gr/?show=stats"><font color=cyan> 0 </td>\n\t\t '
<type 'exceptions.TypeError'>: unsupported operand type(s) for +: 'int' and 'str'
args = ("unsupported operand type(s) for +: 'int' and 'str'",)
message = "unsupported operand type(s) for +: 'int' and 'str'"
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.python
csiph-web