Python/pyserial cx_freeze Compilation error: no module named tools - python-2.7

I am trying to compile a python code with cx_freeze in Windows 7, python 2.7, but it keeps giving me trouble because of pyserial. I tried to import the pyserial tools module in many different ways but I keep getting compilation errors:
import serial
import serial.tools
from serial.tools import list_ports
#I also tried:
#import serial.tools.list_ports
#from serial import tools
#import serial.tools.list_ports
#from serial import tools
The error message varies between:
ImportError: No module named tools
and
ImportError: No module named tools.list_ports
Any ideas on how to solve this issue? Thanks.

Related

Why can I import a Cython module when working in one directory but not when working in another?

I am making some tests to learn using Cython. I am using pyximport to import a Cython module into a Python script and I found the following problem:
If I execute the script while working in one directory, building the module fails. The error message says:
from . import Pipeline
ImportError: Building module mymodule failed: ["ImportError: Building module _laplace failed: ['ImportError: cannot import name Pipeline\n']\n"]
On the contrary, if I copy my Python script and the Cython module in a subfolder, everything works fine.
Can anyone tell me why this is happening?

training SyntaxNet from parser_trainer_test.sh (ImportError: cannot import name tf_logging)

I am new to python and SyntaxNet and I am trying to train SyntaxNet from SyntaxNet Tutorial.
To trained the model I updated parser_trainer_test.sh based on The Tutorial. and ran it as follow:
ubuntu#ubuntu-VirtualBox:~/models/syntaxnet$ syntaxnet/parser_trainer_test.sh
It gave me this error:
syntaxnet/parser_trainer_test.sh: line 36: /home/ubuntu/models/syntaxnet/syntaxnet/parser_trainer: No such file or directory
Then I updated "$BINDIR/parser_trainer" \ in line 35 of parser_trainer_test.sh to "$BINDIR/parser_trainer.py" \ and ran it again.
And it gave me this error:
File "/home/ubuntu/models/syntaxnet/syntaxnet/parser_trainer.py", line 25,in <module>
from tensorflow.python.platform import tf_logging as logging
ImportError: cannot import name tf_logging
I went through tf_logging.py and all other python files in syntaxnet/tensorflow/python/platform
I think that's where the error is. But if you want, I can post more.
parser.trainer.py :
import os
import os.path
import time
import tensorflow as tf
from tensorflow.python.platform import tf_logging as logging # this is where error happens
from tensorflow.python.platform import gfile
tf_logging.py:
import logging
import os
import sys
import time
from logging import DEBUG
from logging import ERROR
from logging import FATAL
from logging import INFO
from logging import WARN
There is something that I am suspecious about (I am not perofessional so sorry if it seems silly). I found a file named logging.hin path tensorflow/tensorflow/core/platform which defines DEBUG,ERROR,FATAL,.. and I get confused whether the aim of the model is the logging package from python or this logging.h file. If am wrong, which is probable, please help me through this problem.
I suspect the problem is that you are trying to run the script directly, and it expects to be invoked by Bazel (so that the environment, paths, etc. are set up appropriately). Try the following command instead:
$ bazel test //syntaxnet:parser_trainer_test

ImportError: cannot import name webdriver

I am implementing selenium and i have already included "from selenium import webdriver" but still getting this error
"ImportError: cannot import name webdriver"
Any idea how to resolve this error?
Cross check your language binding, check with older versions

Import error for numpy

I downloaded numpy1.8 for python 2.7
Installed fine, but when i give:
from numpy.fft import fft, fftfreq
it gives me a huge error, which ends with
from numpy.core.multiarray import (
ImportError: cannot import name datetime_data
How can i get rid of this error ?
I need numpy to perform fft functions.
Any kind of help is appreciated.

ImportError: No module named NetCDF

I am trying to sort the following error but not getting the correct answer till now. Actually I am using Ubuntu 10.04 and I have installed netcdf-3.6.2 but even then i found this error, although I added the header like
import Scientific.IO.NetCDF
from Numeric import *
from NetCDF import *
But it does not make any impact and shows the following error:
ImportError: No module named NetCDF
If the module is Scientific.IO.NetCDF, then you need to do from Scientific.IO.NetCDF import * (and you don't need to do import Scientific.IO.NetCDF first). Also, importing everything is often a bad style, and should be avoided.