cx_Freeze on complex python program - python-3.4

I'm trying to create an executable out of a file that I have made with python. I got cx_Freeze to work, but once I try to open the exe file, it will say that "there is no module named ..." I am trying to make an executable out of a program that starts with:
import serial
import time
import re
import tkinter
import math
from scipy.interpolate import interp1d
import numpy as np
import os
My setup.py file currently looks like this:
import cx_Freeze
import sys
base = None
if sys.platform == 'win32':
base = "Win32GUI"
executables = [cx_Freeze.Executable("SerialComsCombined.py", base=base)]
cx_Freeze.setup(
name = "4DCT_Client",
options = {"build_exe": {"packages":["tkinter"]}},
version = "0.01",
description = "Serial Coms Combined",
executables = executables
)
I feel like the setup.py file needs to be modified. Any suggestions?

Related

importing SQLite3 in GoLang

I want to import SQLite3 for my Project
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
But this Error happened:
could not import github.com/mattn/go-sqlite3 (no required module provides package "github.com/mattn/go-sqlite3")
I checked my GOPATH and go module but i couldn't fix it.
thanks for helping me out.

Not able to import simpletransformers.ner in python as it says ImportError: cannot import name 'BertweetTokenizer'

I am trying to do bert based NER and trying to import,
from simpletransformers.ner import NERModel, NERArgs
I have installed simpletranformers in pip and when I try to import,
import simpletransformers.ner
it says, ImportError: cannot import name 'BertweetTokenizer'. When I try to install BertweetTokenizer, it throws
ERROR: No matching distribution found for BertweetTokenizer
Not sure, what I am missing. Kindly help

Apache Lounge server is not responding for rpy2 package on windows machine

import rpy2.robjects as robjects
from rpy2.robjects import pandas2ri
Apache + mod_wsgi + python 3.x configuration is working pretty nice on my windows machine. It is rpy2 package which is actually giving me trouble. However the same piece of code is working for me in the command line/IDLE.
I tried putting this configuration in the httpd.conf file from the below shared link:
WSGIApplicationGroup %{GLOBAL}
https://serverfault.com/questions/514242/non-responsive-apache-mod-wsgi-after-installing-scipy
Still no luck..
Code where it's failing:
import rpy2.robjects as robjects
from rpy2.robjects import pandas2ri
def calculate_from_data(self, path):
pandas2ri.activate()
r = robjects.r
print("running R.........")
filepath = path + os.sep + 'vectorization.R'
r.source(filepath)
vectorize = r['vectorize']
matrix = vectorize(self.base_data.df)
Apache should give me the same result as running those code in command line/IDLE gives?. Need help on this please..
For example: piece of code which is executing as expected from CMD/IDLE:
import rpy2.rinterface as rinterface
from rpy2.robjects.packages import importr
print("initializing...")
rinterface.initr()
print(" done.")
print("Mapping the R base package...")
base = importr('base')
print(" done.")
output:
initializing...
done.
Mapping the R base package...
done.
But the same code is not working on Apache.

ImportError: cannot import name 'label_map_util'

I'm running on Python 3.6.5 (64bits) trying to run the object_detection_tutorial.
I receive this message when I run the programm :
ImportError: cannot import name 'label_map_util'
Any idea on what I should do ?
Edit : I tried to see whether or not I installed the API and got this :
C:\tensorflow\models-master>python object_detection/protos/label_map_util_test.py
python: can't open file 'object_detection/protos/label_map_util_test.py': [Errno 2] No such file or directory
Try this instead...
from object_detection.utils import label_map_util
Get current dir :
os.getcwd()
change current dir :
os.chdir( '../models/research/object_detection' )
CD to object_detection directory
And you can replace
from utils import label_map_util to
from object_detection.utils import label_map_util
and
from utils import visualization_utils as vis_util to
from object_detection.utils import visualization_utils as vis_util

py2app: Compiles app but app has error on opening

I am working on a Python application in Python3.6 that I would like to convert into a standalone application that can be ported easily to other devices. I tried using py2app as in this tutorial.
Everything works well until I get to the point of actually creating the app. It does not throw any error in the creation process and creates the .app file, however, when I try to run it, A window pops up saying there is an error and gives me the options of terminating or opening the console. I tried opening the console but I cannot find any substantive information in the error messages.
These are the import statements that I have:
from urllib.request import urlopen, build_opener
from bs4 import BeautifulSoup, SoupStrainer
import ssl
import urllib
import sys
import subprocess
from tkinter import *
from tkinter.ttk import *
import webbrowser
from unidecode import unidecode
As far as I know the only 2 packages that aren't standard with python are bs4 and unidecode. My setup.py file looks like this:
from setuptools import setup
APP = ['GUImain.py']
DATA_FILES = ['logo.png']
OPTIONS = {'argv_emulation': True,
'iconfile': 'logo.png',
'includes': ['undidecode','bs4']}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
I haven't seen any other errors like this one from any of my searching. I have seen some suggestion that py2app doesn't fully support Python3.6. Does anyone know how I can figure out what error is being thrown? Any suggestions on different tools to use and tutorials on how to use them?

Resources