Re: i just moved from bottleframework to flask. I changes what needed to be altered to convert the code and when i run it i just get "Internal server error" Running tail -f ../logs/error_log i get no

2021-07-09 Thread Menno Holscher

Op 09-07-2021 om 15:01 schreef vergos@gmail.com:

please tell me what i need to do to be able to see error messages in browser 
and not only via console:

app = Flask(__name__)
app.debug = True
application = app

The above only displays error via console into the error_log, having to open it 
each time. how can i see it in browser?

This is totally unrelated to your earlier question, and (as many things 
Flask) well documented.


Look at 
https://flask.palletsprojects.com/en/2.0.x/debugging/#the-built-in-debugger


--
Met vriendelijke groet / Kind regards

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Re: i just moved from bottleframework to flask. I changes what needed to be altered to convert the code and when i run it i just get "Internal server error" Running tail -f ../logs/error_log i get no

2021-07-09 Thread Menno Holscher

Op 09-07-2021 om 08:14 schreef vergos@gmail.com:

Στις Παρασκευή, 9 Ιουλίου 2021 στις 12:03:00 π.μ. UTC+3, ο χρήστης Menno 
Holscher έγραψε:

Op 08-07-2021 om 15:42 schreef vergos@gmail.com:

import flask
dir(flask)

['Blueprint', 'Config', 'Flask', 'Markup', 'Request', 'Response',
'Session', '__builtins__', '__cached__', '__doc__', '__file__',
'__loader__', '__name__', '__package__', '__path__', '__spec__',
'__version__', '_app_ctx_stack', '_compat', '_request_ctx_stack',
'abort', 'after_this_request', 'app', 'appcontext_popped',
'appcontext_pushed', 'appcontext_tearing_down',
'before_render_template', 'blueprints', 'cli', 'config',
'copy_current_request_context', 'ctx', 'current_app', 'escape', 'flash',
'g', 'get_flashed_messages', 'get_template_attribute', 'globals',
'got_request_exception', 'has_app_context', 'has_request_context',
'helpers', 'json', 'json_available', 'jsonify', 'make_response',
'message_flashed', 'redirect', 'render_template',
'render_template_string', 'request', 'request_finished',
'request_started', 'request_tearing_down', 'safe_join', 'send_file',
'send_from_directory', 'session', 'sessions', 'signals',
'signals_available', 'stream_with_context', 'template_rendered',
'templating', 'url_for', 'wrappers']
... there is no "run" there. What were you trying to achieve?

When you look at the exported symbols, there is no route, so if you 
expected flask to export route it is not there either.

How is that even possible?

Do i have  something wrong in the www.py?

from flask import Flask, route, request, redirect, render_template, url_for, 
send_from_directory, debug

app = Flask(__name__)
app.run(debug=True)


There is 2 possibilities here. One is you have a module named route. 
Than you do not import it as a name from flask, but as a module.


The other is you are looking for the attribute route from the Flask class.

@app.route("/item/", methods=["GET", "POST"])

This creates a route. The route method is a method of an instance of 
Flask (i.e. app), so importing Flask is enough.


Also i use run for this

app.run( host='superhost.gr', port=5000, debug=True )


Yes, that is OK, if DNS contains a host superhost.gr.

--
Met vriendelijke groet / Kind regards

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Re: i just moved from bottleframework to flask. I changes what needed to be altered to convert the code and when i run it i just get "Internal server error" Running tail -f ../logs/error_log i get no

2021-07-08 Thread Menno Holscher

Op 08-07-2021 om 15:42 schreef vergos@gmail.com:

i just moved from bottleframework to flask. I changes what needed to be altered to 
convert the code and when i run it i just get "Internal server error"
This error is the error any web site shows when the code of your 
application has an error.

How can i find out what is the culprit here?

 [nikos@superhost wsgi]$ export FLASK_APP=www.py
 [nikos@superhost wsgi]$ export FLASK_ENV=development
 [nikos@superhost wsgi]$ flask run
  * Serving Flask app 'www.py' (lazy loading)
  * Environment: development
  * Debug mode: on
 Usage: flask run [OPTIONS]
 Try 'flask run --help' for help.
 
 Error: While importing 'www', an ImportError was raised:
 
 Traceback (most recent call last):

   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 256, in 
locate_app
 __import__(module_name)
   File "/home/nikos/wsgi/www.py", line 4, in 
 import counters
   File "/home/nikos/wsgi/counters.py", line 6, in 
 from flask import run, route, request, redirect
 ImportError: cannot import name 'run'

When I import flask in the REPL (the Python command processor) and look 
at what it exports:


>>> import flask
>>> dir(flask)
['Blueprint', 'Config', 'Flask', 'Markup', 'Request', 'Response', 
'Session', '__builtins__', '__cached__', '__doc__', '__file__', 
'__loader__', '__name__', '__package__', '__path__', '__spec__', 
'__version__', '_app_ctx_stack', '_compat', '_request_ctx_stack', 
'abort', 'after_this_request', 'app', 'appcontext_popped', 
'appcontext_pushed', 'appcontext_tearing_down', 
'before_render_template', 'blueprints', 'cli', 'config', 
'copy_current_request_context', 'ctx', 'current_app', 'escape', 'flash', 
'g', 'get_flashed_messages', 'get_template_attribute', 'globals', 
'got_request_exception', 'has_app_context', 'has_request_context', 
'helpers', 'json', 'json_available', 'jsonify', 'make_response', 
'message_flashed', 'redirect', 'render_template', 
'render_template_string', 'request', 'request_finished', 
'request_started', 'request_tearing_down', 'safe_join', 'send_file', 
'send_from_directory', 'session', 'sessions', 'signals', 
'signals_available', 'stream_with_context', 'template_rendered', 
'templating', 'url_for', 'wrappers']

... there is no "run" there. What were you trying to achieve?

If you are thinking about the "flask run" mentioned in startup, that is 
a bash/cmd command, an easy way to start the server from the command line:


(venv):~/python/debtors> export FLASK_APP=debtors ; flask run
 * Serving Flask app "debtors"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production 
deployment.

   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)


--
Met vriendelijke groet / Kind regards

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Re: Php vs Python gui (tkinter...) for small remote database app

2021-06-15 Thread Menno Holscher

Op 15-06-2021 om 19:14 schreef Grant Edwards:

On 2021-06-15, Menno Holscher  wrote:


There is no difference regarding security concerns.


I find that hard to believe given the long list of CVEs I've just had
to sort through for even fairly recent versions of PHP. I just can't
belive that Python has anywhere close to that many secruity issues.

An excellent example. The "concerns" here are "Is this platform safe?" 
and "Does the supplier/community react promptly to security problems?". 
In case of PHP indeed the safety of the platform is a worry, however, 
apparently if there is a problem, action is taken.


How does the Tkinter/TCL/TK software or the PyQt/Qt do in that respect? 
Just looking at the number of CVEs, is that enough? What if one of these 
stacks has few, but long outstanding security problems? Would that be 
better or worse than the situation for PHP?


As an aside, I do not know the amount of CVEs PHP nor Python is 
receiving. When I search the NIST CVE database for the word Python I get 
43 hits for the last 3 months. None of those are against the language or 
the CPython interpreter and only 1 against a Standard Library package or 
module (urllib3). A lot of the others are for web frameworks and 
extensions for those, as well as Tensorflow. So as you argue, it seems 
Python does really well as a secure development platform.

--
Met vriendelijke groet / Kind regards

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Re: Php vs Python gui (tkinter...) for small remote database app

2021-06-15 Thread Menno Holscher

Op 14-06-2021 om 21:17 schreef Pascal B via Python-list:

Hi,
I would like to know if for a small app for instance that requires a connection 
to a remote server database if php is more suitable than Python mainly 
regarding security.
Php requires one port for http and one port for the connection to the database open. If using Python with a tkinter gui, I understand a small app can connect to a database so only one port to the database would need to be accessed/open listening to connection. So I would need to worry less 
about security if using Python over Php for something small, like a small 
python app that I give over to users.


Am I missing something in this assertion?


There is no difference regarding security concerns.

In the case of a PHP (or any web app for that matter) you indeed have to 
worry about the security of the connection to the browser. But, e.g. the 
access to the database is only in one place, on the server. If you use a 
Tkinter application, each user will have the access to the database at 
his/her own machine, causing other worries than connection security. The 
attack vector may be different, but the worries are no less or more in 
one of the solutions.


First investigate what you need to be afraid of/worried about, do not 
make a decision on a simple criterion like the number of connections.


--
Met vriendelijke groet / Kind regards

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Re: Standarize TOML?

2021-05-17 Thread Menno Holscher

Op 16-05-2021 om 00:39 schreef Jason C. McDonald:

During the Steering Committee presentation at PyCon, it was mentioned
that no one has formally proposed TOML be added to the standard library
(emphasis on formal). THe joke went forth that there would be a flood
of proposals to that end.

So, just to kick this off while the thought is still fresh in a bunch of
people's minds: **should we add a TOML parser to the standard library**?



See here: 
https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068



I, for one, feel like this is obvious.


You are not the only one. The game is already on for some time.


--
Met vriendelijke groet / Kind regards

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Re: Please help test astral char display in tkinter Text (especially *nix)

2020-11-04 Thread Menno Holscher

Op 03-11-2020 om 04:04 schreef Terry Reedy:
Perhaps half of the assigned chars in the first plane are printed 
instead of being replaced with a narrow box. This includes emoticons as 
foreground color outlines on background color.  Maybe all of the second 
plane of extended CJK chars are printed.  The third plane is unassigned 
and prints as unassigned boxes (with an X).


If you get errors, how many.  If you get a hang or crash, how far did 
the program get?



openSuse Linux 15.2 Leap, Python 3.6.10, tcl and tk 8.6.7

The program runs fine, but complains in the text scrollbox:
0x1 character U+1 is above the range (U+-U+) allowed by Tcl

until

0x3ffe0 character U+3ffe0 is above the range (U+-U+) allowed by Tcl

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Re: celery multi celery.exceptions.TimeoutError: The operation timed out

2020-09-21 Thread Menno Holscher

Op 21-09-2020 om 12:14 schreef iMath:

Asked 3 days ago at 
https://stackoverflow.com/questions/63951696/celery-multi-celery-exceptions-timeouterror-the-operation-timed-out

But nobody helped yet, anyone ?

Did you see 
https://stackoverflow.com/questions/9769496/celery-received-unregistered-task-of-type-run-example 
?


The error says "Received unregistered task of type 'proj.tasks.add'", so 
it looks very much like your registry is not correct/complete.


Vriendelijke groeten/Kind regards,

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Re: Module exists and cannot be found

2020-09-09 Thread Menno Holscher

Op 09-09-2020 om 07:35 schreef James Moe via Python-list:

python 3.6.10
opensuse tumbleweed
Tumbleweed is a rolling distro, so that is extremely old for Tumbleweed. 
I would expect Python 3.8.4 or 3.8.5 to be current there.


If you want to use another version, you would have to run in a virtual 
environment. Did you do that?

linux 5.8.4


Module PyQt5 is most definitely installed. 
How did you check? You want to be in the same virtual environment the 
program runs in.


From my installation (openSuse Leap, so there I run Python 3.6):

Python 3.6.10 (default, Jan 16 2020, 09:12:04) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'PyQt5'
>>>

No PyQt5 as I do not have a Qt program in the environment :=)

Vriendelijke groet/Kind regards,

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list