Python msilib for mac - python

I'm trying to run a python script that has the following import statement:
from ast import keyword
from email.policy import default
from msilib.schema import ComboBox
from statistics import variance
import tkinter as tk
from tkinter import Variable, ttk
from turtle import onclick, width
I get an error on From msilib.schema import Combobox. I'm using a Mac and I see the lib is Microsofts, is there a way I can import a package so that I can use msilib on my Machine.
EDIT: The work around for anyone having the same issue is to run a virtual box with windows. It would still be nice to know how to run it on MAC but oh well...

Related

transform python tkinter GUI to EXE file

I have been working on developing a GUI application using tkinter which is 100% working properly when running it from pycharm... and now I can't convert my script into an EXE file.
I have tried pyinstaller, cxfreeze and py2exe but everyone of them has a problem. pyinstaller show me 'Fatal error'... and cxfreeze seems to have a problem with MATPLOTLIB
Here are the libraries I am using:
import numpy as np
import tkinter
from random import randint
from tkinter import *
import tkinter as tk
from math import sqrt
from matplotlib.backends.backend_tkagg import (
FigureCanvasTkAgg, NavigationToolbar2Tk)
from matplotlib.backend_bases import key_press_handler
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
from math import sqrt
from scipy import stats
from scipy.stats import beta
I don't want to post my code due to confidientality issues...
Does anybody has another idea ot do this ?
EDIT:
I reinstalled python as admin and reinstalled pyintaller
enter image description here
and when I tried to convert the script here is the command error it shows:
'pyinstaller' is not recongnized as an internal command or external ...
also I need to mention that the exe file of pyintaller in not founded in the directory of installation of python in C:programfiles/python37

Atom is rearranging my import lines on save

When working on a python script, Atom rearranges my lines by moving some import lines to the top
I only have the AutoPep8 plugin which I disabled and this still happens. I've also looked at the Whitespace plugin as well but it doesn't have the settings I'd expect that could cause this behavior:
Before save
#! /usr/bin/env python
"""
Random doc text
"""
import sys
import os
import math
package_path = os.path.dirname(os.path.dirname(__file__))
sys.path.append(package_path)
from parent import package
import scipy
On save
#! /usr/bin/env python
import scipy
from parent import package
"""
Random doc text
"""
import sys
import os
import math
package_path = os.path.dirname(os.path.dirname(__file__))
sys.path.append(package_path)
I can ctl-z to undo this. Is there a way to disable/fix this behavior?
Got the same problem, but restart of the atom after I disabled the autopep plugin worked for me. This looks like a bug in autopep8 plugin

CX_Freeze issue after build in use tl.testing?

I am doing a small game in which I use "from tl.testing.thread import ThreadJoiner" to execute threads when executing from console the program as such works but when creating the executable with the help of cx_freeze I have the problem that when executing the program I get an error respect tl tells me that the module tl is not found and the program is not executed.
the error is this:
C:\Users\The.hacker\AppData\Local\Programs\Python\Python36-32\lib\site-packgages\cx_freeze\initscripts\_startup_.py",line 14,in run
module.run()
file:
C:\Users\The.hacker\AppData\Local\Programs\Python\Python36-32\lib\site-packgages\cx_freeze\initscripts\Console.py",line 26,in run
exec(code,m._dict_))
file "the_last_warrior",line 11,in <module>
Modulenotfounderror:no module named tl
on line 11 is the from tl.testing.thread import ThreadJoiner
now the image:
my file main is "the_last_warrior.py"
from tkinter import *
from tkinter import ttk
import tkinter as tk
import tkinter
from tl.testing.thread import ThreadJoiner
import threading
import datetime
from threading import Thread
has more than 1600 lines,In itself, how would the correct import of this module be? (from tl.testing.thread import ThreadJoiner)
picture of error:
console_vs_exe.jpg
After trying many things, I solved by copying the package directly from the folder "Lib \ site-packages" my package "tl" and paste it into the Lib folder of my program already ready after using the setup.py the program executes runs as I expected.

importError tkinter when importing matplotlib

I am unable to import matplotlib on this deep learning AMI from aws marketplace
import matplotlib.pyplot as plt
And I get this error
ImportError: No module named 'tkinter'
What I've tried (and the errors returned):
pip install tkinter
> No matching distribution found for TKinter
sudo yum install tkinter
> No package tkinter available.
> Error: Nothing to do
I personnally had this kind of troubles with tkinter, before to realize it requires a 't' in python3 and a 'T' in python2. so when I need compatibility my codes contain:
import sys
if sys.version_info[0]>2:
# for Python 3
import tkinter as tk
else:
# for Python 2
import Tkinter as tk
I hope this help
First find location of matplotlibrc file
import matplotlib
matplotlib.matplotlib_fname()
u'/usr/local/lib64/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc'
Then go to this file and change the current configuration of backend to
backend : agg
This does not solve the problem of import Tkinter, but it does allow the import of pyplot
This worked for me:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pylab as plt
Had the same problem after updating to new matplotlib 2.x on python 3.5.x

How do i convert a python3.4 script(that has installed modules) into a windows executable using py2exe?

I have a python script that i have to import all these modules, which some of them require downloading:
import datetime
from dateutil import parser
from tkinter import filedialog
import tkinter
import mailbox
import pprint
import json
import urllib.request
from tkinter import *
Is there a way, using py2exe, i can convert the script into a windows executable. If so, how?
To simplify the procedure, you will want to have all your modules already downloaded. This can be accomplished with a simple "pip install " from command prompt. Then it is as simple as writing and running a setup.py file - detailed directions for how to do this can be found here.

Categories

Resources