raspberry 3b+ firebase

Thread Starter

melili

Joined Mar 31, 2021
17
Hello, I am using Raspberry Pi 3B +. For my graduation project, I have to collect the data in firebas and display it in android, but I get an error like this. I would be very happy if you could help. This project is very important to me.


PYTHON 3.7.3

from .async import process_pool
^
SyntaxError: invalid syntax
 

Ya’akov

Joined Jan 27, 2019
9,070
The problem is in the distribution of firebase. If you install the latest version, it's fixed:

Code:
pip install git+https://github.com/ozgur/python-firebase
That's a command line.
 

Thread Starter

melili

Joined Mar 31, 2021
17
The problem is in the distribution of firebase. If you install the latest version, it's fixed:

Code:
pip install git+https://github.com/ozgur/python-firebase
That's a command line.
I wrote this code on the command line, but the same error continues.
 

MrSalts

Joined Apr 2, 2020
2,767
Change your first line to...
from .multiprocess_pool import process_pool

Then rename your file in the firebase library from
/usr/local/lib/python3.7/dist-packages/firebase/async.py
To
/usr/local/lib/python3.7/dist-packages/firebase/multiprocess_pool.py

Or, revert to Python 3.6 where async is not a keyword.
 

Thread Starter

melili

Joined Mar 31, 2021
17
Change your first line to...
from .multiprocess_pool import process_pool

Then rename your file in the firebase library from
/usr/local/lib/python3.7/dist-packages/firebase/async.py
To
/usr/local/lib/python3.7/dist-packages/firebase/multiprocess_pool.py

Or, revert to Python 3.6 where async is not a keyword.
How can I activate a different version in raspberry pi. I have 2.7.16. Because I couldn't change the file names.
 

Thread Starter

melili

Joined Mar 31, 2021
17
The problem is a conflict in some versions of firebase because "async" is a reserved keyword in Python itself.
I'm not sure, but you might have more than one version of Python installed. That installed for 2.7, are you using 3.x for your program?
Yes I am using 2.7.16. But the text editor shows 3.7.3 how can I change it. But both are loaded.
 

Thread Starter

melili

Joined Mar 31, 2021
17
The problem is a conflict in some versions of firebase because "async" is a reserved keyword in Python itself.
I'm not sure, but you might have more than one version of Python installed. That installed for 2.7, are you using 3.x for your program?
WhatsApp Image 2021-04-01 at 01.46.36.jpeg
 

Thread Starter

melili

Joined Mar 31, 2021
17
Change your first line to...
from .multiprocess_pool import process_pool

Then rename your file in the firebase library from
/usr/local/lib/python3.7/dist-packages/firebase/async.py
To
/usr/local/lib/python3.7/dist-packages/firebase/multiprocess_pool.py

Or, revert to Python 3.6 where async is not a keyword.
I noticed that python scripts work wonderfully in the IDE, but fail when run from a terminal window.

Further examination disclosed that the version of python used with the IDE, (Thonny), is 3.7.3, but the version used by the terminal is 2.7.16.

I would have thought that both the IDE and the terminal would automagically use the same version, but apparently this is not true.

1. Why is this so?
2. Obviously python 3.7.3 is installed on this latest (?) How can I fix this because firebase doesn't work in this version.
 

MrSalts

Joined Apr 2, 2020
2,767
Use the command
sudo mv oldFileName.py newFileName.py

The operating system may ask for your RPi password before executing the command - default is: raspberry (unless you changed it.

it is not letting you change the password without the “sudo” (super user do) prefix because the file is not in your home path. This is a security of Linux so you think twice before you do something that could cause problems with the operating system.
 

Thread Starter

melili

Joined Mar 31, 2021
17
Use the command
sudo mv oldFileName.py newFileName.py

The operating system may ask for your RPi password before executing the command - default is: raspberry (unless you changed it.

it is not letting you change the password without the “sudo” (super user do) prefix because the file is not in your home path. This is a security of Linux so you think twice before you do something that could cause problems with the operating system.

mv: Could not state 'async.py': There is no such file or directory


Thanks a lot for your answer but I got an error like this. How can I fix this?

I wrote that

sudo mv async.py nasync.py
 

MrSalts

Joined Apr 2, 2020
2,767
You have to be in the working directory where async.py is located before entering the command,
Or,
You have to use the full file path for old and new file name
 

MrSalts

Joined Apr 2, 2020
2,767
A single command, all on one line as...
Code:
sudo mv  /usr/local/lib/python3.7/dist-packages/firebase/async.py  /usr/local/lib/python3.7/dist-packages/firebase/multiprocess_pool.py
or,

Code:
cd  /usr/local/lib/python3.7/dist-packages/firebase/
sudo mv async.py  multiprocess_pool.py
 

Thread Starter

melili

Joined Mar 31, 2021
17
A single command, all on one line as...
Code:
sudo mv  /usr/local/lib/python3.7/dist-packages/firebase/async.py  /usr/local/lib/python3.7/dist-packages/firebase/multiprocess_pool.py
or,

Code:
cd  /usr/local/lib/python3.7/dist-packages/firebase/
sudo mv async.py  multiprocess_pool.py
1234.jpeg
Thank you very much, I was able to change the file name to the code you suggested. But I also need to make changes in the command line here. How can I do this?
 
Top