Re: How to format a datetime MySQL database field to local using strftime()

2019-02-26 Thread vergos . nikolas
Actually i just found it has a directive: dictrows: Whether or not to support dict-like access to row objects (default: True). so i just did: plugin = bottle_pymysql.Plugin( dbuser='nikos', dbpass='*', dbname='counters', dictrows=False ) and now it works with indexes as integers not as st

Re: missing 1 required positional argument error

2019-02-26 Thread vergos . nikolas
Τη Τρίτη, 26 Φεβρουαρίου 2019 - 5:21:14 μ.μ. UTC+2, ο χρήστης Calvin Spealman έγραψε: > you call it by visiting the route you've mapped to it, so when you run this > app and navigate to the root / URL it gets called. What do you expect this > parameter to be and where did you expect it to come fro

Re: missing 1 required positional argument error

2019-02-26 Thread vergos . nikolas
Τη Τρίτη, 26 Φεβρουαρίου 2019 - 5:21:14 μ.μ. UTC+2, ο χρήστης Calvin Spealman έγραψε: > you call it by visiting the route you've mapped to it, so when you run this > app and navigate to the root / URL it gets called. What do you expect this > parameter to be and where did you expect it to come fro

missing 1 required positional argument error

2019-02-26 Thread vergos . nikolas
I'm receiving the following error: Traceback (most recent call last): File "/usr/lib64/python3.6/site-packages/bottle.py", line 862, in _handle return route.call(**args) File "/usr/lib64/python3.6/site-packages/bottle.py", line 1740, in wrapper rv = callback(*a, **ka) File "/usr/lib6

Re: How to format a datetime MySQL database field to local using strftime()

2019-02-26 Thread vergos . nikolas
Τη Τρίτη, 26 Φεβρουαρίου 2019 - 3:26:29 μ.μ. UTC+2, ο χρήστης vergos@gmail.com έγραψε: > Can you help me rewrite this function, which when iam using 'pymysql' > conncector works normally, it does not when iam using 'bottle_pymysql' > > def coalesce( data ): > newdata = [] > seen

Re: How to format a datetime MySQL database field to local using strftime()

2019-02-26 Thread vergos . nikolas
Can you help me rewrite this function, which when iam using 'pymysql' conncector works normally, it does not when iam using 'bottle_pymysql' def coalesce( data ): newdata = [] seen = {} for host, ref, location, useros, browser, visits, hits, downloads, authuser in data:

Re: How to format a datetime MySQL database field to local using strftime()

2019-02-24 Thread vergos . nikolas
Τη Δευτέρα, 25 Φεβρουαρίου 2019 - 12:38:43 π.μ. UTC+2, ο χρήστης vergos@gmail.com έγραψε: > Τη Κυριακή, 24 Φεβρουαρίου 2019 - 8:52:03 μ.μ. UTC+2, ο χρήστης DL Neil > έγραψε: > > Vergos, > > > > Please provide more information and show how you've debugged the code so > > far... > > > > > >

Re: How to format a datetime MySQL database field to local using strftime()

2019-02-24 Thread vergos . nikolas
Τη Κυριακή, 24 Φεβρουαρίου 2019 - 8:52:03 μ.μ. UTC+2, ο χρήστης DL Neil έγραψε: > Vergos, > > Please provide more information and show how you've debugged the code so > far... > > > On 25/02/19 7:03 AM, vergos.niko...@gmail.com wrote: > > pymydb.execute( '''SELECT host, ref, location, useros, b

How to format a datetime MySQL database field to local using strftime()

2019-02-24 Thread vergos . nikolas
pymydb.execute( '''SELECT host, ref, location, useros, browser, visits, hits, downloads, authuser FROM guests WHERE pagesID = (SELECT ID FROM pages WHERE url = %s) ORDER BY visits DESC''', page ) data = pymydb.fetchall() for visit in visits:

Re: Convert a list with wrong encoding to utf8

2019-02-14 Thread vergos . nikolas
I'm using Python3 and pymysql and already have charset presnt [python] con = pymysql.connect( db = 'clientele', user = 'vergos', passwd = '**', charset = 'utf8' ) cur = con.cursor() [/python] From that i understand that the names being fetched from the db to pyhton script are being fetced a

Re: Convert a list with wrong encoding to utf8

2019-02-14 Thread vergos . nikolas
Τη Πέμπτη, 14 Φεβρουαρίου 2019 - 8:56:31 μ.μ. UTC+2, ο χρήστης MRAB έγραψε: > It doesn't have a 'b' prefix, so either it's Python 2 or it's a Unicode > string that was decoded wrongly from the bytes. Yes it doesnt have the 'b' prefix so that hexadecimal are representation of strings and not rep

Re: Convert a list with wrong encoding to utf8

2019-02-14 Thread vergos . nikolas
Τη Πέμπτη, 14 Φεβρουαρίου 2019 - 9:14:08 μ.μ. UTC+2, ο χρήστης Igor Korot έγραψε: > Hi, > > On Thu, Feb 14, 2019 at 1:10 PM wrote: > > > > Τη Πέμπτη, 14 Φεβρουαρίου 2019 - 8:16:40 μ.μ. UTC+2, ο χρήστης Calvin > > Spealman έγραψε: > > > If you see something like this > > > > > > '\xce\x86\xce\xb

Re: Convert a list with wrong encoding to utf8

2019-02-14 Thread vergos . nikolas
Τη Πέμπτη, 14 Φεβρουαρίου 2019 - 8:16:40 μ.μ. UTC+2, ο χρήστης Calvin Spealman έγραψε: > If you see something like this > > '\xce\x86\xce\xba\xce\xb7\xcf\x82 > \xce\xa4\xcf\x83\xce\xb9\xce\xac\xce\xbc\xce\xb7\xcf\x82' > > then you don't have a string, you have raw bytes. You don't "encode" bytes

Re: Convert a list with wrong encoding to utf8

2019-02-14 Thread vergos . nikolas
Τη Πέμπτη, 14 Φεβρουαρίου 2019 - 6:45:29 μ.μ. UTC+2, ο χρήστης Calvin Spealman έγραψε: > You can only decode FROM the same encoding you've encoded TO. Any decoding > must know the input it receives follows the rules of its encoding scheme. > latin1 is not utf8. > > However, in your case, you aren

Convert a list with wrong encoding to utf8

2019-02-14 Thread vergos . nikolas
Hello, i have tried the following to chnage encoding to utf8 because for some reason it has changed regarding list names [python] #populate client listing into list names.append( name ) names.append( '' ) names.sort() for name in names:

Selection based ob variables issue

2019-02-01 Thread vergos . nikolas
Hello, iam tryting to execute mysql queries based on python variables. name = request.args.get('name') month = request.args.get('month') year = request.args.get('year') try: if '=' not in name + month + year: cur.execute( '

Return html data + serve a file

2018-10-09 Thread vergos . nikolas
Hello, iam using Python + Flask. Iam trying to print some html and also serve a file to the user. My code is: pdata = pdata + '' # Prepare selected file for download filename = request.form.get('filename') filepath = '/home/user/wsgi/static/files/'