[web2py] Trying out this PosOnlineStore app

2021-05-18 Thread Maurice Waka
I know this app was designed some time ago, I have two issues I need help 
on.
1. I tried it out this app 
 
using 
python3.6 but got this error when using the 'buy' function:

File 
"/home/maurice/web2py/applications/PosOnlineStore/controllers/default.py" 
,
 
line 49, in buy
total,form.vars.cvv,0.0,invoice,testmode=True):
File "/home/maurice/web2py/gluon/contrib/AuthorizeNet.py", line 211, in 
process
payment.process()
File "/home/maurice/web2py/gluon/contrib/AuthorizeNet.py", line 127, in 
process
url, encoded_args).read()).split(self.delimiter)
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 524, in open
req = meth(req)
File "/usr/lib/python3.6/urllib/request.py", line 1255, in do_request_
raise TypeError(msg)
TypeError: POST data should be bytes, an iterable of bytes, or a file object. 
It cannot be of type str.

2. Though I do not have the best way to code it, I was hoping to add some 
options where once a user does some purchases, the amounts used to purchase 
are updated to another table on an accrual manner. After which I wanted to 
do some taxation issues e.g. tax discounts after period of time on the 
accrued amounts, how can this be possible?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/62d4fd07-9fb9-4bbb-a88e-be937e2751ccn%40googlegroups.com.


Re: [web2py] How to read image in blob format from a existing db

2021-05-18 Thread Kevin Keller
Potentially. I woukd file a problem in github and use raw sql as workaround
for now.

Adding the py4web community to this





On Tue, May 18, 2021, 20:23 Chris  wrote:

> I could do it with pydal but with sqlite3 library worked perfect. Is maybe
> a pydal bug ?
>
>
> Cheers.
>
> --
> Sent from Canary 
>
> On martes, may. 18, 2021 at 1:59 p. m., Chris 
> wrote:
> Data is already in binary in db.
>
>
>
> Making more test when pydal retrieve the blob data from the db is only
> getting just a part of the information.
>
> When in print the rows after the select i get a small sample like this:
>
> images = cherry_db(cherry_db.image.node_id ==
> i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)
>
> for m in images:
>print(m['png’])
>
> b'<\xd1\x88\x1c4l\x04\x84\xce 0\x13\xc6\x01\r\xdd\xd0'
>
>
> Cheers
>
> --
> Sent from Canary 
>
> On martes, may. 18, 2021 at 1:51 p. m., Kevin Keller 
> wrote:
> I think you have to convert the image file to binary data before saving
> tad blob etc..?
>
>
> https://pynative.com/python-mysql-blob-insert-retrieve-file-image-as-a-blob-in-mysql/
>
>
>
> On Tue, May 18, 2021, 19:04 Chris  wrote:
>
>> Hi, i’m trying to read images from a existing sqlite db. For some reason
>> when i save the images to disk, they are corrupted.
>> this is my code:
>>
>> cherry_db = DAL('sqlite://{}'.format(form.vars.cherry_file),
>> folder=upload_folder, migrate=False)
>>
>> cherry_db.define_table('image',
>> Field('node_id', 'integer', requires=IS_NOT_EMPTY()),
>> Field('png', 'blob')
>> )
>>
>> images = cherry_db(cherry_db.image.node_id ==
>> i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)
>>
>> for m in images:
>>name = str(uuid.uuid4())
>>print('image {}'.format(name))
>>print(m['png'])
>>im = open('{}'.format(session.project_folder+'/'+name+'.png'), 'wb')
>>im.write(m['png'])
>>im.close()
>>
>>
>> Any help is appreciated
>>
>> Cheers.
>> Chris.
>>
>> --
>> Sent from Canary 
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary
>> 
>> .
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CADHCKLTUpqY99R9qfcgvJ7Thi9263LSbtD2XJx6NjEym-kLQgQ%40mail.gmail.com
> 
> .
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/3f7419fc-a9e0-4ca6-b031-dd2839be2ca4%40Canary
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CADHCKLRXA%2BTxUVjdtumZ19b%3DwBUXuTqkBWLXK-rd8TUpteuj%2BA%40mail.gmail.com.


Re: [web2py] How to read image in blob format from a existing db

2021-05-18 Thread Chris
I could do it with pydal but with sqlite3 library worked perfect. Is maybe a 
pydal bug ?

Cheers.

--
Sent from Canary (https://canarymail.io)

> On martes, may. 18, 2021 at 1:59 p. m., Chris  (mailto:chriiisti...@gmail.com)> wrote:
> Data is already in binary in db.
>
>
>
> Making more test when pydal retrieve the blob data from the db is only 
> getting just a part of the information.
>
> When in print the rows after the select i get a small sample like this:
>
> images = cherry_db(cherry_db.image.node_id == 
> i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)
>
> for m in images:
> print(m['png’])
>
>
> b'<\xd1\x88\x1c4l\x04\x84\xce 0\x13\xc6\x01\r\xdd\xd0'
>
>
> Cheers
>
> --
> Sent from Canary (https://canarymail.io)
>
> > On martes, may. 18, 2021 at 1:51 p. m., Kevin Keller  > (mailto:keller...@gmail.com)> wrote:
> > I think you have to convert the image file to binary data before saving tad 
> > blob etc..?
> >
> > https://pynative.com/python-mysql-blob-insert-retrieve-file-image-as-a-blob-in-mysql/
> >
> >
> >
> > On Tue, May 18, 2021, 19:04 Chris  > (mailto:chriiisti...@gmail.com)> wrote:
> > > Hi, i’m trying to read images from a existing sqlite db. For some reason 
> > > when i save the images to disk, they are corrupted.
> > > this is my code:
> > >
> > > cherry_db = DAL('sqlite://{}'.format(form.vars.cherry_file), 
> > > folder=upload_folder, migrate=False)
> > >
> > > cherry_db.define_table('image',
> > > Field('node_id', 'integer', requires=IS_NOT_EMPTY()),
> > > Field('png', 'blob')
> > > )
> > >
> > >
> > > images = cherry_db(cherry_db.image.node_id == 
> > > i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)
> > >
> > > for m in images:
> > > name = str(uuid.uuid4())
> > > print('image {}'.format(name))
> > > print(m['png'])
> > > im = open('{}'.format(session.project_folder+'/'+name+'.png'), 'wb')
> > > im.write(m['png'])
> > > im.close()
> > >
> > >
> > >
> > > Any help is appreciated
> > >
> > > Cheers.
> > > Chris.
> > >
> > > --
> > > Sent from Canary (https://canarymail.io)
> > >
> > > --
> > > Resources:
> > > - http://web2py.com
> > > - http://web2py.com/book (Documentation)
> > > - http://github.com/web2py/web2py (Source code)
> > > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > > ---
> > > You received this message because you are subscribed to the Google Groups 
> > > "web2py-users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an 
> > > email to web2py+unsubscr...@googlegroups.com 
> > > (mailto:web2py+unsubscr...@googlegroups.com).
> > > To view this discussion on the web visit 
> > > https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary
> > >  
> > > (https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary?utm_medium=email&utm_source=footer).
> > --
> > Resources:
> > - http://web2py.com
> > - http://web2py.com/book (Documentation)
> > - http://github.com/web2py/web2py (Source code)
> > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > ---
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to web2py+unsubscr...@googlegroups.com 
> > (mailto:web2py+unsubscr...@googlegroups.com).
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/web2py/CADHCKLTUpqY99R9qfcgvJ7Thi9263LSbtD2XJx6NjEym-kLQgQ%40mail.gmail.com
> >  
> > (https://groups.google.com/d/msgid/web2py/CADHCKLTUpqY99R9qfcgvJ7Thi9263LSbtD2XJx6NjEym-kLQgQ%40mail.gmail.com?utm_medium=email&utm_source=footer).

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3f7419fc-a9e0-4ca6-b031-dd2839be2ca4%40Canary.


Re: [web2py] How to read image in blob format from a existing db

2021-05-18 Thread Chris
Data is already in binary in db.

Making more test when pydal retrieve the blob data from the db is only getting 
just a part of the information.

When in print the rows after the select i get a small sample like this:

images = cherry_db(cherry_db.image.node_id == 
i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)

for m in images:
print(m['png’])

b'<\xd1\x88\x1c4l\x04\x84\xce 0\x13\xc6\x01\r\xdd\xd0'

Cheers

--
Sent from Canary (https://canarymail.io)

> On martes, may. 18, 2021 at 1:51 p. m., Kevin Keller  (mailto:keller...@gmail.com)> wrote:
> I think you have to convert the image file to binary data before saving tad 
> blob etc..?
>
> https://pynative.com/python-mysql-blob-insert-retrieve-file-image-as-a-blob-in-mysql/
>
>
>
> On Tue, May 18, 2021, 19:04 Chris  (mailto:chriiisti...@gmail.com)> wrote:
> > Hi, i’m trying to read images from a existing sqlite db. For some reason 
> > when i save the images to disk, they are corrupted.
> > this is my code:
> >
> > cherry_db = DAL('sqlite://{}'.format(form.vars.cherry_file), 
> > folder=upload_folder, migrate=False)
> >
> > cherry_db.define_table('image',
> > Field('node_id', 'integer', requires=IS_NOT_EMPTY()),
> > Field('png', 'blob')
> > )
> >
> >
> > images = cherry_db(cherry_db.image.node_id == 
> > i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)
> >
> > for m in images:
> > name = str(uuid.uuid4())
> > print('image {}'.format(name))
> > print(m['png'])
> > im = open('{}'.format(session.project_folder+'/'+name+'.png'), 'wb')
> > im.write(m['png'])
> > im.close()
> >
> >
> >
> > Any help is appreciated
> >
> > Cheers.
> > Chris.
> >
> > --
> > Sent from Canary (https://canarymail.io)
> >
> > --
> > Resources:
> > - http://web2py.com
> > - http://web2py.com/book (Documentation)
> > - http://github.com/web2py/web2py (Source code)
> > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > ---
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to web2py+unsubscr...@googlegroups.com 
> > (mailto:web2py+unsubscr...@googlegroups.com).
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary
> >  
> > (https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary?utm_medium=email&utm_source=footer).
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/CADHCKLTUpqY99R9qfcgvJ7Thi9263LSbtD2XJx6NjEym-kLQgQ%40mail.gmail.com
>  
> (https://groups.google.com/d/msgid/web2py/CADHCKLTUpqY99R9qfcgvJ7Thi9263LSbtD2XJx6NjEym-kLQgQ%40mail.gmail.com?utm_medium=email&utm_source=footer).

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b627c3b9-0527-4124-8a57-f47ff511c427%40Canary.


Re: [web2py] How to read image in blob format from a existing db

2021-05-18 Thread Kevin Keller
I think you have to convert the image file to binary data before saving tad
blob etc..?

https://pynative.com/python-mysql-blob-insert-retrieve-file-image-as-a-blob-in-mysql/



On Tue, May 18, 2021, 19:04 Chris  wrote:

> Hi, i’m trying to read images from a existing sqlite db. For some reason
> when i save the images to disk, they are corrupted.
> this is my code:
>
> cherry_db = DAL('sqlite://{}'.format(form.vars.cherry_file),
> folder=upload_folder, migrate=False)
>
> cherry_db.define_table('image',
> Field('node_id', 'integer', requires=IS_NOT_EMPTY()),
> Field('png', 'blob')
> )
>
> images = cherry_db(cherry_db.image.node_id ==
> i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)
>
> for m in images:
>name = str(uuid.uuid4())
>print('image {}'.format(name))
>print(m['png'])
>im = open('{}'.format(session.project_folder+'/'+name+'.png'), 'wb')
>im.write(m['png'])
>im.close()
>
>
> Any help is appreciated
>
> Cheers.
> Chris.
>
> --
> Sent from Canary 
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CADHCKLTUpqY99R9qfcgvJ7Thi9263LSbtD2XJx6NjEym-kLQgQ%40mail.gmail.com.


[web2py] How to read image in blob format from a existing db

2021-05-18 Thread Chris
Hi, i’m trying to read images from a existing sqlite db. For some reason when i 
save the images to disk, they are corrupted.
this is my code:

cherry_db = DAL('sqlite://{}'.format(form.vars.cherry_file), 
folder=upload_folder, migrate=False)

cherry_db.define_table('image',
Field('node_id', 'integer', requires=IS_NOT_EMPTY()),
Field('png', 'blob')
)

images = cherry_db(cherry_db.image.node_id == 
i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)

for m in images:
name = str(uuid.uuid4())
print('image {}'.format(name))
print(m['png'])
im = open('{}'.format(session.project_folder+'/'+name+'.png'), 'wb')
im.write(m['png'])
im.close()

Any help is appreciated

Cheers.
Chris.

--
Sent from Canary (https://canarymail.io)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary.