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

Michael Ross gmx at ross.cx
Thu Mar 7 14:06:37 CET 2013


On Thu, 07 Mar 2013 13:25:58 +0100, Νίκος Γκρ33κ <nikos.gr33k at gmail.com>  
wrote:

> Τη Πέμπτη, 7 Μαρτίου 2013 1:51:42 μ.μ. UTC+2, ο χρήστης Michael Ross  
> έγραψε:
>> On Thu, 07 Mar 2013 12:27:03 +0100, Νίκος Γκρ33κ <nikos.gr33k at 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 at 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.



More information about the Python-list mailing list