[web2py] UnicodeEncodeError

2020-06-08 Thread aabelyakov
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2020
Version 2.20.4-stable+timestamp.2020.05.03.05.18.50
Database drivers available: sqlite3, psycopg2, imaplib, pymysql

please visit:
http://127.0.0.1:8000/
use "kill -SIGTERM 7474" to shutdown the web2py server


ERROR:Rocket.Errors.Thread-4:Traceback (most recent call last):

  File "/home/aab/web2py/gluon/rocket.py", line 1292, in run
self.run_app(conn)

  File "/home/aab/web2py/gluon/rocket.py", line 1806, in run_app
self.write(data, sections)

  File "/home/aab/web2py/gluon/rocket.py", line 1726, in write
self.conn.sendall(b'%x\r\n%s\r\n' % (len(data), to_bytes(data, 
'ISO-8859-1')))

  File "/home/aab/web2py/gluon/packages/dal/pydal/_compat.py", line 141, in 
to_bytes
return obj.encode(charset, errors)

UnicodeEncodeError: 'latin-1' codec can't encode character '\u0430' in 
position 0: ordinal not in range(256)

-- 
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/c0e598c3-2b0a-4a29-a3af-cc9c2df1dd88o%40googlegroups.com.


[web2py] Error importing Russian characters from csv file

2020-03-31 Thread aabelyakov
When importing data (russian characters) from a .csv-file into a table, an 
error occurs:
 'ascii' codec can't decode byte 0xd0 in 
position 65: ordinal not in range(128).

Standalone PyDAL works fine!
=
import locale 
print('locale.getpreferredencoding(False) =', 
locale.getpreferredencoding(False))

db.import_from_csv_file(
open('applications/upoweron/databases/csv/all.csv'),
restore=True,
encoding="utf-8",
)

db.commit()
=
Result:
locale.getpreferredencoding(False) = ANSI_X3.4-1968

-- 
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/f7b13070-34b6-49f7-aa2c-1cedca02de86%40googlegroups.com.


[web2py] APScheduler ValueError

2014-09-08 Thread aabelyakov
At the start of the function XXX() from the library uLib.py using 
APScheduler ValueError exception occurs.
What to do?

OS - Ubuntu 12.04 64 bits
Web2py version - 2.9.8
APScheduler version = 3.0.0

controller - opros.py
~
import uLib as l
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.date import DateTrigger

sched = BackgroundScheduler()
sched.start()

sched.add_job(
l.XXX, 
trigger=DateTrigger(), 
args=[db, session] 
)

user library - uLib.py
~~
def XXX(db, ss):
print db
print db.tables
print db(db.bus.id==ss.iBusId).select(db.bus.snaim).first().snaim
#enddef

Log file

2014-09-09 09:19:30,615 - apscheduler.scheduler - INFO - start(132) - 
Scheduler started
2014-09-09 09:19:30,624 - apscheduler.scheduler - INFO - _real_add_job(743) 
- Added job "XXX" to job store "default"
2014-09-09 09:19:30,640 - apscheduler.scheduler - INFO - remove_job(513) - 
Removed job 91d564aae40c4848a8e87d836f6d1eea
2014-09-09 09:19:30,647 - apscheduler.executors.default - INFO - 
run_job(106) - Running job "XXX (trigger: date[2014-09-09 09:19:30 MSK], 
next run at: 2014-09-09 09:19:30 MSK)" (scheduled at 2014-09-09 
09:19:30.614321+04:00)



['obj', 'bus', 'krp', 'pdr', 'lgh', 'sht', 'cdz', 'cdp', 'par', 'trf', 
'osht', 'opas', 'opke', 'ojrn', 'ompf', 'oenr', 'opwr', 'opw1', 'opw2', 
'owri', 'orqs', 'orpt', 'oini', 'auth_user', 'auth_group', 
'auth_membership', 'auth_permission', 'auth_event', 'auth_cas']

2014-09-09 09:19:30,701 - apscheduler.executors.default - ERROR - 
_LogErrorReplacement(1426) - Job "XXX (trigger: date[2014-09-09 09:19:30 
MSK], next run at: 2014-09-09 09:19:30 MSK)" raised an exception
Traceback (most recent call last):
  File 
"/usr/local/lib/python2.7/dist-packages/apscheduler/executors/base.py", 
line 108, in run_job
retval = job.func(*job.args, **job.kwargs)
  File "applications/upoweron/modules/uLib.py", line 11858, in XXX
sNaim = db(db.bus.id==ss.iBusId).select(db.bus.snaim).first().snaim
  File "/home/aab/MyPython/web2py/gluon/dal.py", line 10724, in select
return adapter.select(self.query, fields, attributes)
  File "/home/aab/MyPython/web2py/gluon/dal.py", line 2464, in select
return super(SQLiteAdapter, self).select(query, fields, attributes)
  File "/home/aab/MyPython/web2py/gluon/dal.py", line 1874, in select
return self._select_aux(sql, fields, attributes)
  File "/home/aab/MyPython/web2py/gluon/dal.py", line 1839, in _select_aux
self.execute(sql)
  File "/home/aab/MyPython/web2py/gluon/dal.py", line 1960, in execute
return self.log_execute(*a, **b)
  File "/home/aab/MyPython/web2py/gluon/dal.py", line 1945, in log_execute
if not self.connection: raise ValueError(a[0])
ValueError: SELECT  bus.snaim FROM bus WHERE (bus.id = 7);

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to run the sheduler on AppFog?

2013-06-17 Thread aabelyakov


-- 

--- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: TypeError: __call__() takes exactly 3 arguments (4 given)

2013-01-15 Thread aabelyakov
It works! Thanks... 

понедельник, 14 января 2013 г., 21:43:26 UTC+4 пользователь Massimo Di 
Pierro написал:
>
> Very odd. Can you try replace
>
> thread.start_new_thread(start_browser,
> (get_url(ip, proto=proto, port=port),),
> dict(startup=True))
>
> with
>
> thread.start_new_thread(start_browser,
> (get_url(ip, proto=proto, port=port), 
> True))
>
> On Sunday, 13 January 2013 23:44:45 UTC-6, aabelyakov wrote:
>>
>> ubuntu v.11.04 (Natty), v.12.04 (Precise), windows 8
>> web2py v.2.3.2 (2012-12-17 15:03:30) stable
>>
>>
>> When you run web2py.py without parameter -a 
>>
>> Exception in Tkinter callback
>> Traceback (most recent call last):
>> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
>> return self.func(*args)
>> File "/home/aabelyakov/MyPython/web2py/gluon/widget.py", line 514, in 
>> start
>> dict(startup=True))
>> TypeError: __call__() takes exactly 3 arguments (4 given)
>>
>

-- 





[web2py] TypeError: __call__() takes exactly 3 arguments (4 given)

2013-01-13 Thread aabelyakov
ubuntu v.11.04 (Natty), v.12.04 (Precise), windows 8
web2py v.2.3.2 (2012-12-17 15:03:30) stable


When you run web2py.py without parameter -a 

Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
File "/home/aabelyakov/MyPython/web2py/gluon/widget.py", line 514, in start
dict(startup=True))
TypeError: __call__() takes exactly 3 arguments (4 given)

-- 





[web2py] Re: TypeError: can't pickle file objects

2012-08-28 Thread aabelyakov
GLib.py put in the directory modules. Import it from the model file 
scheduler.py. Run it in the background with the parameters db and session. 
it works!
Thank you! The question is closed...

вторник, 28 августа 2012 г., 20:17:40 UTC+4 пользователь Massimo Di Pierro 
написал:
>
> The definitively goes in modules.
>
> On Monday, 27 August 2012 23:50:27 UTC-5, aabelyakov wrote:
>>
>> gLib.py - this is a common library of functions and procedures. It uses 
>> global variables attached to the session.
>>
>> понедельник, 27 августа 2012 г., 23:00:37 UTC+4 пользователь Massimo Di 
>> Pierro написал:
>>>
>>> gLib.py is probably a module, not a model. I would put it there. Why it 
>>> fails I cannot say, I do not know what it does.
>>>
>>>

-- 





[web2py] Re: TypeError: can't pickle file objects

2012-08-27 Thread aabelyakov
gLib.py - this is a common library of functions and procedures. It uses 
global variables attached to the session.

понедельник, 27 августа 2012 г., 23:00:37 UTC+4 пользователь Massimo Di 
Pierro написал:
>
> gLib.py is probably a module, not a model. I would put it there. Why it 
> fails I cannot say, I do not know what it does.
>
>

-- 





[web2py] TypeError: can't pickle file objects

2012-08-27 Thread aabelyakov
After placing gLib.py module into directory "models" web2py (versions 2.0 
and 1.99.7 on Windows and Ubuntu) fails:

Traceback (most recent call last):
File "/home/aabelyakov/MyPython/web2py/gluon/main.py", line 528, in wsgibase
session._try_store_on_disk(request, response)
File "/home/aabelyakov/MyPython/web2py/gluon/globals.py", line 594, in 
_try_store_on_disk
cPickle.dump(dict(self), response.session_file)
File "/usr/lib/python2.7/copy_reg.py", line 70, in _reduce_ex
raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle file objects

In what could be the reason?

-- 





[web2py] KeyError: 'routes_logging'

2010-08-11 Thread aabelyakov
OS - Ubuntu 10.04 LTS - Lucid Lynx
web2py - Version 1.82.1 (2010-08-04 18:57:33)
pull from https://web2py.googlecode.com/hg/

KeyError: 'routes_logging'
File "/home/aabelyakov/Web2py/web2py.py", line 17, in 
  import gluon.widget
File "/home/aabelyakov/Web2py/gluon/widget.py", line 28, in 
  import main
File "/home/aabelyakov/Web2py/gluon/main.py", line 66, in 
  rewrite.load()
File "/home/aabelyakov/Web2py/gluon/rewrite.py", line 129, in load
  if p['routes_logging']:

routes.py
=
routes_in = (('/', '/PowerOn/default/index'))
routes_out = (('/PowerOn/default/index', '/'))

After replacing the contents of the line 129
error has disappeared
=
#if p['routes_logging']:
if p.get('routes_logging'):


[web2py] Re: How to return the resources?

2010-04-17 Thread aabelyakov
Jason, thank you for the important addition...

On 17 апр, 13:07, Jason Brower  wrote:
> To add to the closed topic. (:
> Massimo and I worked over this with PySerial and yeah, having a separate
> program to manage the serial connection is actually VITAL.  Especially
> if your making devices that send important other data.  Have that
> external app just update a file in queue with information, and when you
> need it displayed in the webbrowser you can just make a request for the
> status from that file.
> This is similar to the issues found in a webcam.  You don't make the web
> application take a picture of a file when a webpage requests it as it
> would pile full of requests and errors as everyone is trying to use the
> same device.  With a file, like an image, everyone should have access to
> it very easily.
> In my setup I was dealing with industrial robots, some logic had to be
> done faster than the webbrowser could do it.  So having a "machine
> server" as we call it at work, helps take care of those common logic
> steps so that web2py doesn't worry about it.
> BR,
> Jason Brower
>
>
>
> On Sat, 2010-04-17 at 01:46 -0700, aabelyakov wrote:
> > Yes, this is the right decision!
> > Topic closed.
> > Thanks
>
> > On 16 апр, 17:30, mdipierro  wrote:
> > > I think there is a problem with multithreading because of PySerial.
> > > Pyserial open a post connected to COM and COM is a resource that
> > > cannot be shared. In web2py every request is executed in its own
> > > thread so it is not obvious who open the COM, who closes it and how
> > > conflicts are avoided.
>
> > > Please tell us more of what you are doing. The best solution may be
> > > not to use pyserial in a web2py problem but use it in a single
> > > bachground process that talks to web2py via queued messages.
>
> > > Massimo
>
> > > On Apr 16, 2:13 am, aabelyakov  wrote:
>
> > > > I do not use os.chdir or explicit calls to thread module.
> > > > I'm using PySerial and after the error COM port remains open.
> > > > To close it, I restart the web server.
> > > > How to avoid this?
>
> > > > On 15 ÁÐÒ, 22:46, mdipierro  wrote:
>
> > > > > Do you use os.chdir or explicit calls to the thread module in your
> > > > > code?
>
> > > > > On Apr 15, 12:15špm, aabelyakov  wrote:
>
> > > > > > During my application error occurs and it stops giving error ticket.
>
> > > > > > How can I in my application to return the resources of the operating
> > > > > > system
> > > > > > (eg close the COM port) šbefore the error ticket not to restart the
> > > > > > web server?
>
> > > > > > Excuse my bad English...
>
> > > > > > Regards- óËÒÙÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
>
> > > > > - ðÏËÁÚÁÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
>
> > > > --
> > > > Subscription 
> > > > settings:http://groups.google.com/group/web2py/subscribe?hl=en-Скрыть 
> > > > цитируемый текст -
>
> > > - Показать цитируемый текст -- Скрыть цитируемый текст -
>
> - Показать цитируемый текст -


[web2py] Re: NameError: global name 'formstyle' is not defined

2010-04-17 Thread aabelyakov
I re-downloaded a working copy of trunk
from https://web2py.googlecode.com/hg/.

Error disappeared.
Topic closed.
Thanks

On 16 апр, 17:25, mdipierro  wrote:
> where did you get web2py from?
>
> On Apr 16, 2:01 am, aabelyakov  wrote:
>
>
>
> > On 16 апр, 10:21, mdipierro  wrote:
>
> > > In the version in trunk that line is 768 and not 977 and it is
> > > defined. It is an argument of the function.
> > > Your file appear longer than it should be and that is very odd. Please
> > > try download it again.
>
> > I added into sqlhtml.py 2 missing strings:
> >         formstyle = 'table3cols',
> >         self.formstyle = formstyle
>
> > but got the following error:
>
> > File "D:\MyProg\_MyPython\Web2py\gluon\sqlhtml.py", line 803, in
> > __init__
> >     for id,a,b,c in xfields:
> > ValueError: need more than 3 values to unpack
>
> > --
> > Subscription 
> > settings:http://groups.google.com/group/web2py/subscribe?hl=en- Скрыть 
> > цитируемый текст -
>
> - Показать цитируемый текст -


[web2py] Re: How to return the resources?

2010-04-17 Thread aabelyakov
Yes, this is the right decision!
Topic closed.
Thanks

On 16 апр, 17:30, mdipierro  wrote:
> I think there is a problem with multithreading because of PySerial.
> Pyserial open a post connected to COM and COM is a resource that
> cannot be shared. In web2py every request is executed in its own
> thread so it is not obvious who open the COM, who closes it and how
> conflicts are avoided.
>
> Please tell us more of what you are doing. The best solution may be
> not to use pyserial in a web2py problem but use it in a single
> bachground process that talks to web2py via queued messages.
>
> Massimo
>
> On Apr 16, 2:13 am, aabelyakov  wrote:
>
>
>
> > I do not use os.chdir or explicit calls to thread module.
> > I'm using PySerial and after the error COM port remains open.
> > To close it, I restart the web server.
> > How to avoid this?
>
> > On 15 ÁÐÒ, 22:46, mdipierro  wrote:
>
> > > Do you use os.chdir or explicit calls to the thread module in your
> > > code?
>
> > > On Apr 15, 12:15špm, aabelyakov  wrote:
>
> > > > During my application error occurs and it stops giving error ticket.
>
> > > > How can I in my application to return the resources of the operating
> > > > system
> > > > (eg close the COM port) šbefore the error ticket not to restart the
> > > > web server?
>
> > > > Excuse my bad English...
>
> > > > Regards- óËÒÙÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
>
> > > - ðÏËÁÚÁÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
>
> > --
> > Subscription 
> > settings:http://groups.google.com/group/web2py/subscribe?hl=en- Скрыть 
> > цитируемый текст -
>
> - Показать цитируемый текст -


[web2py] Re: How to return the resources?

2010-04-16 Thread aabelyakov
I do not use os.chdir or explicit calls to thread module.
I'm using PySerial and after the error COM port remains open.
To close it, I restart the web server.
How to avoid this?

On 15 апр, 22:46, mdipierro  wrote:
> Do you use os.chdir or explicit calls to the thread module in your
> code?
>
> On Apr 15, 12:15 pm, aabelyakov  wrote:
>
>
>
> > During my application error occurs and it stops giving error ticket.
>
> > How can I in my application to return the resources of the operating
> > system
> > (eg close the COM port)  before the error ticket not to restart the
> > web server?
>
> > Excuse my bad English...
>
> > Regards- Скрыть цитируемый текст -
>
> - Показать цитируемый текст -


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: NameError: global name 'formstyle' is not defined

2010-04-16 Thread aabelyakov


On 16 апр, 10:21, mdipierro  wrote:
> In the version in trunk that line is 768 and not 977 and it is
> defined. It is an argument of the function.
> Your file appear longer than it should be and that is very odd. Please
> try download it again.


I added into sqlhtml.py 2 missing strings:
formstyle = 'table3cols',
self.formstyle = formstyle


but got the following error:

File "D:\MyProg\_MyPython\Web2py\gluon\sqlhtml.py", line 803, in
__init__
for id,a,b,c in xfields:
ValueError: need more than 3 values to unpack


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] NameError: global name 'formstyle' is not defined

2010-04-15 Thread aabelyakov
Version 1.76.5 (2010-03-20 12:12:17)
web2py source code  from trunk

File "D:\MyProg\_MyPython\Web2py\gluon\sqlhtml.py", line 799, in
__init__
if formstyle == 'table3cols':
NameError: global name 'formstyle' is not defined


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] How to return the resources?

2010-04-15 Thread aabelyakov
During my application error occurs and it stops giving error ticket.

How can I in my application to return the resources of the operating
system
(eg close the COM port)  before the error ticket not to restart the
web server?

Excuse my bad English...

Regards


-- 
To unsubscribe, reply using "remove me" as the subject.