Re: [pgadmin-hackers] Qt runtime issue on python 3 + patch

2016-06-16 Thread Surinder Kumar
Hi Dave,

On Wed, Jun 15, 2016 at 10:48 AM, Surinder Kumar <
surinder.ku...@enterprisedb.com> wrote:

> On Wed, Jun 15, 2016 at 10:46 AM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>> Hi Surinder,
>>
>> On Sat, Jun 11, 2016 at 11:08 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Sat, Jun 11, 2016 at 2:17 PM, Asser Schrøder Femø
>>>  wrote:
>>> > Hello pgadmin hackers,
>>> >
>>> > I checked out the newly released beta and wanted to see how easy it
>>> would be
>>> > to package for Arch Linux, but ran into this error with the Qt runtime:
>>> >
>>> > Python path:
>>> >
>>> "/home/asser/.virtualenvs/pgadmin4-python34/lib/python3.4/site-packages;/home/asser/src/pgadmin4-beta1/web"
>>> > Webapp path:  "/home/asser/projects/pgadmin4/web/pgAdmin4.py"
>>> > Traceback (most recent call last):
>>> >   File "/home/asser/projects/pgadmin4/web/pgAdmin4.py", line 23, in
>>> 
>>> > import config
>>> >   File "/home/asser/projects/pgadmin4/web/config.py", line 255, in
>>> 
>>> > from config_local import *
>>> >   File "", line 2237, in _find_and_load
>>> >   File "", line , in
>>> > _find_and_load_unlocked
>>> >   File "", line 2164, in _find_spec
>>> >   File "", line 1940, in find_spec
>>> >   File "", line 1914, in _get_spec
>>> >   File "", line 2049, in find_spec
>>> >   File "", line 53, in _path_join
>>> >   File "", line 53, in 
>>> > TypeError: 'str' does not support the buffer interface
>>> > "Failed to launch the application server, server thread exiting."
>>> >
>>> > According to Stackoverflow, exchanging PyBytes_FromString with
>>> > PyUnicode_DecodeFSDefault when building the pythonpath makes it work
>>> again
>>> > (see attached diff). I don't know why though, perhaps somebody will be
>>> able
>>> > to enlighten me :-)
>>> >
>>> > Same issue and fix on Python 3.4 and 3.5 on Arch Linux. I don't know
>>> if the
>>> > patch has any complications on other platforms.
>>>
>>> If I'm reading the docs right, PyUnicode_DecodeFSDefault was added in
>>> Python 3.3, so I've tweaked the patch a little (see attached). I know
>>> the current code has worked on some 3.x versions but I don't know
>>> which exactly as I don't currently have them here, but I'll bet it was
>>> 3.2 or below. Ashesh - can you have the most appropriate person from
>>> the team check this works on 3.0 through 3.5 please?
>>>
>> Can you please take a look at it?
>>
> Sure.
>

Following is the analaysis of compiling runtime environment on Ubuntu14.04
with various python versions.

*1. When compiled with Python-3.2*

It compiled successfully but on running pgAdmin4 executable it shows syntax
error:

(py32)surinder@ubuntu:~/Developments/pgadmin4/runtime$ echo $PYTHONPATH
:/home/surinder/.virtualenvs/py32/lib:/home/surinder/.virtualenvs/py32/lib/python3.2/site-packages

(py32)surinder@ubuntu:~/Developments/pgadmin4/runtime$ ./pgAdmin4
Python path:  ""
Webapp path:  "/home/surinder/Developments/pgadmin4/web/pgAdmin4.py"
Traceback (most recent call last):
  File "/home/surinder/Developments/pgadmin4/web/pgAdmin4.py", line 24, in

from pgadmin import create_app
  File "/home/surinder/Developments/pgadmin4/web/pgadmin/__init__.py", line
254
if response.content_type == u'text/html; charset=utf-8':
  ^
SyntaxError: invalid syntax
"Failed to launch the application server, server thread exiting."

I got same error when I run pgAdmin4 with python installed from repository
and with python compiled from source.
Upon further investigation it seems to be encoding issue.

*2. pgAdmin4 compiled and run successfully on Python-3.3 & 3.4. *

I didn't face the error @asser is facing while running pgAdmin4.

>
>> --
>>
>> Thanks & Regards,
>>
>> Ashesh Vashi
>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>> 
>>
>>
>> *http://www.linkedin.com/in/asheshvashi*
>> 
>>
>>>
>>> > Thanks for building the successor to pgAdmin3! It already looks good
>>> and I'm
>>> > looking forward to further refinement. Hopefully I'll be able to
>>> contribute
>>> > a bit along the way.
>>>
>>> Cool - many thanks!
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>>
>>> --
>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>
>>>
>>
>


Re: [pgadmin-hackers] Qt runtime issue on python 3 + patch

2016-06-14 Thread Surinder Kumar
On Wed, Jun 15, 2016 at 10:46 AM, Ashesh Vashi <
ashesh.va...@enterprisedb.com> wrote:

> Hi Surinder,
>
> On Sat, Jun 11, 2016 at 11:08 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Sat, Jun 11, 2016 at 2:17 PM, Asser Schrøder Femø
>>  wrote:
>> > Hello pgadmin hackers,
>> >
>> > I checked out the newly released beta and wanted to see how easy it
>> would be
>> > to package for Arch Linux, but ran into this error with the Qt runtime:
>> >
>> > Python path:
>> >
>> "/home/asser/.virtualenvs/pgadmin4-python34/lib/python3.4/site-packages;/home/asser/src/pgadmin4-beta1/web"
>> > Webapp path:  "/home/asser/projects/pgadmin4/web/pgAdmin4.py"
>> > Traceback (most recent call last):
>> >   File "/home/asser/projects/pgadmin4/web/pgAdmin4.py", line 23, in
>> 
>> > import config
>> >   File "/home/asser/projects/pgadmin4/web/config.py", line 255, in
>> 
>> > from config_local import *
>> >   File "", line 2237, in _find_and_load
>> >   File "", line , in
>> > _find_and_load_unlocked
>> >   File "", line 2164, in _find_spec
>> >   File "", line 1940, in find_spec
>> >   File "", line 1914, in _get_spec
>> >   File "", line 2049, in find_spec
>> >   File "", line 53, in _path_join
>> >   File "", line 53, in 
>> > TypeError: 'str' does not support the buffer interface
>> > "Failed to launch the application server, server thread exiting."
>> >
>> > According to Stackoverflow, exchanging PyBytes_FromString with
>> > PyUnicode_DecodeFSDefault when building the pythonpath makes it work
>> again
>> > (see attached diff). I don't know why though, perhaps somebody will be
>> able
>> > to enlighten me :-)
>> >
>> > Same issue and fix on Python 3.4 and 3.5 on Arch Linux. I don't know if
>> the
>> > patch has any complications on other platforms.
>>
>> If I'm reading the docs right, PyUnicode_DecodeFSDefault was added in
>> Python 3.3, so I've tweaked the patch a little (see attached). I know
>> the current code has worked on some 3.x versions but I don't know
>> which exactly as I don't currently have them here, but I'll bet it was
>> 3.2 or below. Ashesh - can you have the most appropriate person from
>> the team check this works on 3.0 through 3.5 please?
>>
> Can you please take a look at it?
>
Sure.

>
> --
>
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise PostgreSQL Company
> 
>
>
> *http://www.linkedin.com/in/asheshvashi*
> 
>
>>
>> > Thanks for building the successor to pgAdmin3! It already looks good
>> and I'm
>> > looking forward to further refinement. Hopefully I'll be able to
>> contribute
>> > a bit along the way.
>>
>> Cool - many thanks!
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>


Re: [pgadmin-hackers] Qt runtime issue on python 3 + patch

2016-06-14 Thread Ashesh Vashi
Hi Surinder,

On Sat, Jun 11, 2016 at 11:08 PM, Dave Page  wrote:

> Hi
>
> On Sat, Jun 11, 2016 at 2:17 PM, Asser Schrøder Femø
>  wrote:
> > Hello pgadmin hackers,
> >
> > I checked out the newly released beta and wanted to see how easy it
> would be
> > to package for Arch Linux, but ran into this error with the Qt runtime:
> >
> > Python path:
> >
> "/home/asser/.virtualenvs/pgadmin4-python34/lib/python3.4/site-packages;/home/asser/src/pgadmin4-beta1/web"
> > Webapp path:  "/home/asser/projects/pgadmin4/web/pgAdmin4.py"
> > Traceback (most recent call last):
> >   File "/home/asser/projects/pgadmin4/web/pgAdmin4.py", line 23, in
> 
> > import config
> >   File "/home/asser/projects/pgadmin4/web/config.py", line 255, in
> 
> > from config_local import *
> >   File "", line 2237, in _find_and_load
> >   File "", line , in
> > _find_and_load_unlocked
> >   File "", line 2164, in _find_spec
> >   File "", line 1940, in find_spec
> >   File "", line 1914, in _get_spec
> >   File "", line 2049, in find_spec
> >   File "", line 53, in _path_join
> >   File "", line 53, in 
> > TypeError: 'str' does not support the buffer interface
> > "Failed to launch the application server, server thread exiting."
> >
> > According to Stackoverflow, exchanging PyBytes_FromString with
> > PyUnicode_DecodeFSDefault when building the pythonpath makes it work
> again
> > (see attached diff). I don't know why though, perhaps somebody will be
> able
> > to enlighten me :-)
> >
> > Same issue and fix on Python 3.4 and 3.5 on Arch Linux. I don't know if
> the
> > patch has any complications on other platforms.
>
> If I'm reading the docs right, PyUnicode_DecodeFSDefault was added in
> Python 3.3, so I've tweaked the patch a little (see attached). I know
> the current code has worked on some 3.x versions but I don't know
> which exactly as I don't currently have them here, but I'll bet it was
> 3.2 or below. Ashesh - can you have the most appropriate person from
> the team check this works on 3.0 through 3.5 please?
>
Can you please take a look at it?

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company



*http://www.linkedin.com/in/asheshvashi*


>
> > Thanks for building the successor to pgAdmin3! It already looks good and
> I'm
> > looking forward to further refinement. Hopefully I'll be able to
> contribute
> > a bit along the way.
>
> Cool - many thanks!
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


Re: [pgadmin-hackers] Qt runtime issue on python 3 + patch

2016-06-11 Thread Dave Page
Hi

On Sat, Jun 11, 2016 at 2:17 PM, Asser Schrøder Femø
 wrote:
> Hello pgadmin hackers,
>
> I checked out the newly released beta and wanted to see how easy it would be
> to package for Arch Linux, but ran into this error with the Qt runtime:
>
> Python path:
> "/home/asser/.virtualenvs/pgadmin4-python34/lib/python3.4/site-packages;/home/asser/src/pgadmin4-beta1/web"
> Webapp path:  "/home/asser/projects/pgadmin4/web/pgAdmin4.py"
> Traceback (most recent call last):
>   File "/home/asser/projects/pgadmin4/web/pgAdmin4.py", line 23, in 
> import config
>   File "/home/asser/projects/pgadmin4/web/config.py", line 255, in 
> from config_local import *
>   File "", line 2237, in _find_and_load
>   File "", line , in
> _find_and_load_unlocked
>   File "", line 2164, in _find_spec
>   File "", line 1940, in find_spec
>   File "", line 1914, in _get_spec
>   File "", line 2049, in find_spec
>   File "", line 53, in _path_join
>   File "", line 53, in 
> TypeError: 'str' does not support the buffer interface
> "Failed to launch the application server, server thread exiting."
>
> According to Stackoverflow, exchanging PyBytes_FromString with
> PyUnicode_DecodeFSDefault when building the pythonpath makes it work again
> (see attached diff). I don't know why though, perhaps somebody will be able
> to enlighten me :-)
>
> Same issue and fix on Python 3.4 and 3.5 on Arch Linux. I don't know if the
> patch has any complications on other platforms.

If I'm reading the docs right, PyUnicode_DecodeFSDefault was added in
Python 3.3, so I've tweaked the patch a little (see attached). I know
the current code has worked on some 3.x versions but I don't know
which exactly as I don't currently have them here, but I'll bet it was
3.2 or below. Ashesh - can you have the most appropriate person from
the team check this works on 3.0 through 3.5 please?

> Thanks for building the successor to pgAdmin3! It already looks good and I'm
> looking forward to further refinement. Hopefully I'll be able to contribute
> a bit along the way.

Cool - many thanks!

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Index: runtime/Server.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===
--- runtime/Server.cpp  (revision 702609517f23be7c14e2f9d655f66ea8ac43dd9c)
+++ runtime/Server.cpp  (revision )
@@ -87,7 +87,11 @@
 #ifdef PYTHON2
 PyList_Append(sysPath, 
PyString_FromString(path_list.at(i).toUtf8().data()));
 #else
+#if PY_MINOR_VERSION > 2
+PyList_Append(sysPath, 
PyUnicode_DecodeFSDefault(path_list.at(i).toUtf8().data()));
+#else
 PyList_Append(sysPath, 
PyBytes_FromString(path_list.at(i).toUtf8().data()));
+#endif
 #endif
 }
 }

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Qt runtime issue on python 3 + patch

2016-06-11 Thread Asser Schrøder Femø
Hello pgadmin hackers,

I checked out the newly released beta and wanted to see how easy it would
be to package for Arch Linux, but ran into this error with the Qt runtime:

Python path:
"/home/asser/.virtualenvs/pgadmin4-python34/lib/python3.4/site-packages;/home/asser/src/pgadmin4-beta1/web"
Webapp path:  "/home/asser/projects/pgadmin4/web/pgAdmin4.py"
Traceback (most recent call last):
  File "/home/asser/projects/pgadmin4/web/pgAdmin4.py", line 23, in 
import config
  File "/home/asser/projects/pgadmin4/web/config.py", line 255, in 
from config_local import *
  File "", line 2237, in _find_and_load
  File "", line , in
_find_and_load_unlocked
  File "", line 2164, in _find_spec
  File "", line 1940, in find_spec
  File "", line 1914, in _get_spec
  File "", line 2049, in find_spec
  File "", line 53, in _path_join
  File "", line 53, in 
TypeError: 'str' does not support the buffer interface
"Failed to launch the application server, server thread exiting."

According to Stackoverflow, exchanging PyBytes_FromString with
PyUnicode_DecodeFSDefault when building the pythonpath makes it work again
(see attached diff). I don't know why though, perhaps somebody will be able
to enlighten me :-)

Same issue and fix on Python 3.4 and 3.5 on Arch Linux. I don't know if the
patch has any complications on other platforms.

Thanks for building the successor to pgAdmin3! It already looks good and
I'm looking forward to further refinement. Hopefully I'll be able to
contribute a bit along the way.

cheers,
Asser
diff --git a/runtime/Server.cpp b/runtime/Server.cpp
index 2440268..119add6 100644
--- a/runtime/Server.cpp
+++ b/runtime/Server.cpp
@@ -87,7 +87,7 @@ Server::Server(quint16 port)
 #ifdef PYTHON2
 PyList_Append(sysPath, 
PyString_FromString(path_list.at(i).toUtf8().data()));
 #else
-PyList_Append(sysPath, 
PyBytes_FromString(path_list.at(i).toUtf8().data()));
+PyList_Append(sysPath, 
PyUnicode_DecodeFSDefault(path_list.at(i).toUtf8().data()));
 #endif
 }
 }

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers