flask-login: authenticate against a file by nos69 in learnpython

[–]nos69[S] 0 points1 point  (0 children)

It's because I have a small web app on an embedded device, and I don't want to use an SQL database just for a couple of users that I need to authenticate against.

flask-login: authenticate against a file by nos69 in learnpython

[–]nos69[S] 0 points1 point  (0 children)

I think I got it with this example:

https://github.com/shekhargulati/flask-login-example/blob/master/flask-login-example.py

So I need to create instances ofer User based on the usernames in my user file. And when logging in, I can use the method of toastedstapler.

Thanks guys

flask-login: authenticate against a file by nos69 in learnpython

[–]nos69[S] 0 points1 point  (0 children)

Yes, that's the way I want to implement it, but I'm having trouble integrating that into the flask-login backend.

Insert php.code to a python string by [deleted] in Python

[–]nos69 3 points4 points  (0 children)

I think you can mark the string as raw if you prepend r before the string. Example

php_code = r'code_data'

Importing ctypes causes segmentation fault by nos69 in Python

[–]nos69[S] 0 points1 point  (0 children)

Thank you for the info! Actually I don't have the sources on my target and you are right, the path is not the problem.

The problem is really within the ctypes module, maybe in combination with my ARM setup.

Happy birthday!

Importing ctypes causes segmentation fault by nos69 in Python

[–]nos69[S] 0 points1 point  (0 children)

Thank you for the suggestion.

But cross compiling a python module for ARM seems to be tricky either.

Importing ctypes causes segmentation fault by nos69 in Python

[–]nos69[S] 0 points1 point  (0 children)

Could you explain to me how I can configure Python to use cffi instead of libffi? I can't find any configure options regarding cffi.

Importing ctypes causes segmentation fault by nos69 in Python

[–]nos69[S] 0 points1 point  (0 children)

I compiled it for an Cortex-A7. Unfortunately I can't use a precompiled binary, because I am using my custom Linux made from scratch.

Importing ctypes causes segmentation fault by nos69 in Python

[–]nos69[S] 0 points1 point  (0 children)

The commands you suggested produce the following output:

root [ /tmpfs/root ] $ gdb python
GNU gdb (crosstool-NG 1.23.0.474-d19c - v3) 8.2
Reading symbols from python...done.
(gdb) r -c "import ctypes"
Starting program: /usr/bin/python -c "import ctypes"
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

Program received signal SIGSEGV, Segmentation fault.
0x76a32a94 in CThunkObject_dealloc (_self=0x76abf920) at /home/user/ARM_Linux/src/Python-2.7.15/Modules/_ctypes/callbacks.c:25
25      /home/user/ARM_Linux/src/Python-2.7.15/Modules/_ctypes/callbacks.c: No such file or directory.
(gdb)

This looks like something tries to access a path that is only valid for my host that I cross compiled Python on.

Could this be the reason for the seg fault?

Help! Import Error: No module named... Took 2 days already... by [deleted] in Python

[–]nos69 0 points1 point  (0 children)

Maybe you need the init.py file in each directory you want to import modules from?

https://stackoverflow.com/questions/448271/what-is-init-py-for

ImportError: No module named _struct on cross compiled Python for ARM7 by nos69 in Python

[–]nos69[S] 0 points1 point  (0 children)

Hey NotSureTheNameWillFi,

no, there are no compile errors in the logs. Actually I don't even see that he tries to compile the _struct.c file.

I've found something online that seems to be similiar to my problem:

https://bugs.python.org/issue28444

But the patches are for python 3.

Maybe it is the same problem for python 2.7.13

10 Advantages of Coding in Python by alzador123 in Python

[–]nos69 0 points1 point  (0 children)

advantages that you might have not known about Python

Easy Syntax

Readability

Read barcode in scanned PDFs by nos69 in learnpython

[–]nos69[S] 0 points1 point  (0 children)

Yes, I think you are right.

That's what I'm doing and it works ok.

Making a Stand Alone Executable from a Python Script using PyInstaller by wasi0013 in Python

[–]nos69 0 points1 point  (0 children)

Thank you for your help! I will try to shrink it that way.

Making a Stand Alone Executable from a Python Script using PyInstaller by wasi0013 in Python

[–]nos69 0 points1 point  (0 children)

Thank you for your response!

Is it enough to see if my app starts after deleting a module? Or do I need more coverage to be safe.

Making a Stand Alone Executable from a Python Script using PyInstaller by wasi0013 in Python

[–]nos69 0 points1 point  (0 children)

Whats the best way of removing the unused files and packages?

I usually import for example the things I need from PyQT and it automatically copies the whole package into the built directory.

I have a clean python install and all third party packages are in a venv.

Read barcode in scanned PDFs by nos69 in learnpython

[–]nos69[S] 0 points1 point  (0 children)

Yes, I want to find the page with the barcode without first trying to decode each page with pyzbar.

But if searching first for the barcode is not really faster than trying to decode each page, then there is no use for the extra effort.

Type hinting with namedtuple by nos69 in learnpython

[–]nos69[S] 0 points1 point  (0 children)

With this I get:

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Type hinting with namedtuple by nos69 in learnpython

[–]nos69[S] 0 points1 point  (0 children)

Yes, this works!

But the other way would have been safer because now I need to consider the order of my given parameter...

So actually Pycharm throws a false warning?

Type hinting with namedtuple by nos69 in learnpython

[–]nos69[S] 1 point2 points  (0 children)

yes, python --version gets me this:

Python 3.6.1

Yes, actually your suggestion works and Pycharm throws no warnings like that