python 3.5.3 kivy error - python-3.x

I am developing a small app in python using Kivy for the GUI. So far I have been working with Pycharm and 3.4.3 which works just fine. I have had to upgrade to 3.5.3 and now when I run the script it fails with the following error:
File "/usr/lib/python3/dist-packages/kivy/event.py", line 8, in <module>
import kivy._event
ImportError: No module named 'kivy._event'
Is this a python 3.5.3 kivy 1.9.1 compatibility problem?

Related

PyExcelerator and python 3

I am trying to port a python desktop application which is currently based on python 2.7 to python 3.9. This application is using pyExcelerator 0.6.4a which worked fine in python 2.7 but in python 3.9 I got error:
File "C:\Python39\lib\site-packages\pyExcelerator\__init__.py", line 12, in <module>
from Workbook import Workbook
ModuleNotFoundError: No module named 'Workbook'
probably it is no compatible with python 3.9 (project itself seem a bit abandoned): anyone had same issue ?
Many thanks

Raspberry Pi Stretch visual studio code Python ImportError cannot import name

I'm running Raspbian Stretch, everything is up to date. I'm using visual studio code and writing Python. I'm try to run a simple piece of code in a tutorial:
from datetime import date
print(date.today())
I get an error message saying:
/usr/bin/python3 /home/pi/Python/datetime.py
Traceback (most recent call last):
File "/home/pi/Python/datetime.py", line 1, in <module>
from datetime import date
File "/home/pi/Python/datetime.py", line 1, in <module>
from datetime import date
ImportError: cannot import name 'date'
The interpreter is using Python 3.5.3 32-bit. If I switch the interpreter to Python 2.7, it works. If I run those two lines of code in a terminal using python or python 3, both work. It is just this one interpreter in VS code. I uninstalled and reinstalled python 3.5. What am I missing?

fbs freeze failed with Python 3.6.4

I have the following problem with fbs and Python: I tried to compile Python code and wanted to create an executable .exe file in windows. The command fbs run works fine, but fbs freeze fails.
Package versions:
Python 3.6.4
PyInstaller: 3.4
PyQt5: 5.9.2
Packages that I import:
import re
from itertools import chain
import os
import pandas
from PyQt5.QtWidgets import *
from fbs_runtime.application_context.PyQt5 import ApplicationContext
The output of fbs freeze --debug you see in the attached image:
I used the pyinstaller command to create the exe. This was possible without fbs. Just pyinstaller with the standard comments pyinstaller "...." --onefile --noconsole.
It worked with Python 3.6.4 and pyinstaller 3.4. Perhaps 3.5 would also work. But I know at least that Python 3.8.0 with the newest pyinstaller (even development version from git) doesn't work. I used PyQt5, but some older version 5.12....
It's a bit intransparent...
Best regards,
Markus
fbs runs perfectly fine with python 3.6.x (I am using 3.6.8, PyQt 5.9.2, PyInstaller 3.4).
The python compiler can sometimes get confused if another error happens earlier in the stack. Generally if fbs freeze errors when fbs run works, that points to a library-include error.
See my answer here to include necessary python library resources in your ./src/freeze/windows/ directory and try freezing again: The 'google-api-python-client' distribution was not found and is required by the application with pyinstaller

Import error with tweepy

I am new to python and anaconda.
I am using Python 3.5.1 |Anaconda 4.1.0 (64-bit)| (default, Jun 15 2016, 15:29:36) [MSC v.1900 64 bit (AMD64)]. The version of the notebook server is 4.2.1.
When I issue the following command
import tweepy
it runs successfully.
But when I try to run the following command
%%file test.py
import tweepy
Its getting save as test.py
When I issue the following command
!python test.py
I am getting the following error.
Traceback (most recent call last):
File "test.py", line 2, in <module>
import tweepy
ImportError: No module named tweepy
I am able to see tweepy folders in my anaconda installation directory
D:\Anaconda3\Lib\site-packages
tweepy-3.5.0.dist-info
tweepy
Where am I going wrong. Kindly guide me.
Thanks.
Since I have multiple versions of python installed on my machine this issue exists. So when I point to the correct directory of my python installation, its working fine.

Python3 - runpy.run_path not working on Ubuntu 10.10

I have code like this:
import runpy
runpy.run_path('other.py', globals())
It works on my Windows Box with Python 3.2 but fails on the default Python3 installation (from the Repository) on my Ubuntu 10.10 machine with this message:
Traceback (most recent call last):
File "/home/markus/Documents/projects/BlenderSerialize/generate.py", line 2, in <module>
runpy.run_path('other.py', globals())
AttributeError: 'module' object has no attribute 'run_path'
I checked the documentation and it says that run_path was introduced in Python 2.7. What do I have to do to make this work?
It was introduced in Python 2.7 and 3.2. Hence it will not work with Python 3.0 or 3.1. To make it work, use Python 2.7 or 3.2.
When updating Python3 is not an option there is a workaround that allows one to execute a python script.
The following python code works quite well for me:
exec(compile(open("somefile.py").read(), "somefile.py", 'exec'), local_vars, global_vars)
Other examples can be found in What is an alternative to execfile in Python 3?

Resources