Beginners Module error - xively

Hey guys just playing around with Xively at the moment with a PI.
I am having troubles getting my pi to run the python script tho.
https://xively.com/dev/tutorials/pi/#code
Was the tutorial i used but i keep getting this error.
(venv)pi#raspberrypi /home/xively_tutorial $ python xively_tutorial.py
Traceback (most recent call last):
File "xively_tutorial.py", line 4, in
import xively
ImportError: No module named xively
Any help on fixing this would be much appreciated.
Cheers

My hunch is you have closed down the SSH session after the first install. If you didn't re-source the "activate" command for the Python virtual environment, it wouldn't find the module.
Don't forget the "source .envs/.venv/bin/activate" command before running in a new SSH.

Related

Openstack placement-status upgrade check giving not initialized error

I am trying to install openstack Wallaby on Ubuntu 20.04. I already installed Keystone and Glance and they work as expected. But after I installed Placement and tried to verify it using 'placement-status upgrade check' I constantly get the same error.
Error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/oslo_upgradecheck/upgradecheck.py", line 196, in run
return conf.command.action_fn()
File "/usr/lib/python3/dist-packages/oslo_upgradecheck/upgradecheck.py", line 104, in check
result = func_name(self, **kwargs)
File "/usr/lib/python3/dist-packages/oslo_upgradecheck/common_checks.py", line 41, in check_policy_json
policy_path = conf.find_file(conf.oslo_policy.policy_file)
File "/usr/lib/python3/dist-packages/oslo_config/cfg.py", line 2543, in find_file
raise NotInitializedError()
oslo_config.cfg.NotInitializedError: call expression on parser has not been invoked
Is this normal at this stage or am I doing something wrong here?
I already checked the database connections (user and password work and database is made). And I also checked the username, password and url options in keystone_authtoken in placement.conf but I can't find what's wrong.
I also encountered this problem with Wallaby on Ubuntu 20.04. I solved it with installing Placement from PyPI instead of Ubuntu package manager so far. You should consider how implement starting Placement automatically if you install Placement from this instruction.
Install and configure Placement from PyPI
https://docs.openstack.org/placement/wallaby/install/from-pypi.html
I had the same problem so changed to Victoria, same issue. Digging about in the docs though I found the issue. The command that populate the database looks similar for Keystone, Glance and Placement but for placement the command should be 'su -s /bin/sh -c "placement-manage db sync" placement'. Notice that for placement it is 'db sync' not 'db_sync' as it is for the others. I created scripts, well actuall am using ansible and just cut and pasted between them and my guess is you have done the same. Basically as it does not run the database is empty hence the error.
Guy

Arduino code won't upload

I'm working on a small weather station and yesterday everything was working well. This morning I changed some code and suddenly this came up when I wanted to upload the code to my Adafruit:
java.io.IOException: Cannot run program "{runtime.tools.bossac-
1.7.0.path}/bossac": CreateProcess error=2, The system cannot find the file
specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:207)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
at processing.app.SketchController.upload(SketchController.java:713)
at processing.app.SketchController.exportApplet(SketchController.java:686)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2168)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot
find
the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 8 more
An error occurred while uploading the sketch
Even simple code won't upload anymore. Could someone help me with this? I tried so many things already and I can't figure it out.
Thanks.
I had the same problem with my Adafruit Feather M0. I opened the platform.txt file (running Wordpad as an administrator) located at
C:\Users\[yourPC]\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.2.9\platform.txt
and changed the line
tools.bossac.path={runtime.tools.bossac-1.7.0.path}
to reflect the actual path of the bossac.exe file (mine was at)
C:\Users\[yourPC]\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.2.9\tools\
After restarting Arduino, I was finally able to upload a sketch to my M0.
I have been experiencing the same issue. I found that if I went to my Board Manager and downgraded my Feather boards from 1.6.18 to 1.6.17 it fixed the problem.
java.io.IOException: Cannot run program "{runtime.tools.bossac-
1.7.0.path}/bossac": CreateProcess error=2, The system cannot find the file
specified
The above line says the path to bossac.exe command line application for ATSAMD micro was not found.
Simply Goto --> C:\Users[yourPCnamehere]\AppData\Local\Arduino15\packages\arduino\tools\bossac
Did you find bossac.exe file there?
If not then that's the problem. Simply uninstall the Arduino from your PC and delete the above directory Arduino15 if you have an offline copy of Arduino and then install new version. bossac.exe tool will come with the Arduino package.
Please try this and see if it helps.

pyinstaller ImportError: C extension: No module named np_datetime not built

I am running a virtual environment with Python 2.7 for my program.
There seems to be a problem after creating the executable file on windows.
I ran venv/Scripts/pyinstaller.exe -F main.py
everything seems fine. But when i click on the created executable main.exe.
There is an error.
Tried and tested
I have re-installed of pandas and pyinstaller
Implemented the hook-pandas.py to the hooks folder in the environment.
hook-pandas
Ensured the environment is activated.
Checked that the program is running fine before building executable.
Re-created the environment.
Yet after all that, I am prompted with this issue [see Importerror] when I run the executable file.
It is an extreme pain to debug this because the command prompt displaying the error will not pause but close almost immediately.
Similar issues
Looking for Suggestions
I am hoping for suggestions to troubleshoot Pyinstaller. Any resources to read up on would be nice.
Usually, I have no trouble with python as Pycharm has several handy debugging tools that will help me identify the problem
I ran into the same problem and found this thread, but I managed to solve it borrowing from the reference you posted (about pandas._libs.tslibs.timedeltas), so thank you for that!
In that article, the module that resulted in the ImportError was, in fact pandas._libs.tslibs.timedeltas, if you look at the poster's logs. But the error you and I ran into refers to np_datetime instead. So, from the traceback logs, I finally figured out that the code we have to write in hook-pandas.py should be the following:
hiddenimports = ['pandas._libs.tslibs.np_datetime']
Maybe that alone will solve your problem, HOWEVER, in my case, once I solved the np_datetime issue, other very similar ImportError problems arose (also related to hiddenimports regarding pandas), so, in case you run into the same issues, just define hiddenimports as follows:
hiddenimports = ['pandas._libs.tslibs.np_datetime','pandas._libs.tslibs.nattype','pandas._libs.skiplist']
TL;DR:
You can first try to write
hiddenimports = ['pandas._libs.tslibs.np_datetime']
into hook-pandas.py. However, if for some reason you run into the exact same issues I did afterwards, try
hiddenimports = ['pandas._libs.tslibs.np_datetime','pandas._libs.tslibs.nattype','pandas._libs.skiplist']
If you wish to dive deeper (or run into a different pandas ImportError than the ones I did), this is the code in pandas's __init__.py referenced in your traceback log (lines 23 to 35):
from pandas.compat.numpy import *
try:
from pandas._libs import (hashtable as _hashtable,
lib as _lib,
tslib as _tslib)
except ImportError as e: # pragma: no cover
# hack but overkill to use re
module = str(e).replace('cannot import name ', '')
raise ImportError("C extension: {0} not built. If you want to import "
"pandas from the source directory, you may need to run "
"'python setup.py build_ext --inplace --force' to build "
"the C extensions first.".format(module))
From that I went into the
C:\Python27\Lib\site-packages\pandas_libs
and
C:\Python27\Lib\site-packages\pandas_libs\tslibs
folders and found the exact names of the modules that resulted the errors.
I hope that solves your problem as it did mine.
Cheers!

R EnvironmentError: Could not find Ghostscript on path. RWebLogo

I ran into an odd issue that I cannot fix in any way and I was hoping someone here may have a better understanding of whats wrong;
I am unable to use RWebLogo package - even run the simplest examples due to the same missing Ghostscript error.
e.g. running:
library(RWebLogo)
aln <- c('CCAACCCAA', 'CCAACCCTA', 'AAAGCCTGA', 'TGAACCGGA')
weblogo(seqs=aln, file.out='mylogo.pdf')
Throws this error:
Traceback (most recent call last):
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogo", line 71, in <module>
weblogolib._cli.main()
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/_cli.py", line 82, in main
formatter(data, format, opts.fout)
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/__init__.py", line 757, in pdf_formatter
gs = GhostscriptAPI()
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/__init__.py", line 196, in __init__
raise EnvironmentError("Could not find Ghostscript on path."
EnvironmentError: Could not find Ghostscript on path. There should be either a gs executable or a gswin32c.exe on your system's path
I have installed ghostscript ver 9.15 with configure/make/install in the terminal and then added the PATH to bash profile and executed it. When I run gs in the terminal it works, confirming it is set to the system path, yet the same error still occurs. Even after rebooting.
I tried adding the gs to the environment in R directly:
Sys.setenv(R_GSCMD = "/Applications/ghostscript-9.15/bin/gs")
which also hasn't helped... Gives exactly the same error. When I search the R environment it shows that gs is there.
Important version information:
MAC: OS Yosemite 10.10.1;
R version 3.1.1 (2014-07-10);
Platform: x86_64-apple-darwin10.8.0 (64-bit);
RWebLogo_1.0.3
Do you know of any issue that may have cause this problem? I'm new to programming, so I am worried I may be missing something basic. I would be grateful for any advice. Thank you!
I have gotten in touch with Omar, the author of RWebLogo, and he has been really helpful in pinpointing my problems and resolving the issue.
First, he advised to run the RWebLogo on a test sequence on the terminal:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogo -f test_seqs.txt -o ~/Desktop/out.pdf -F pdf
Change the base directory (everything before extdata/weblogo …) of the script above to be whatever the command below gives you in R:
system.file(package = 'RWebLogo')
I ran it and got a new error: the lack of numpy. I actually had the numpy installed but without full user privileges. After reinstalling numpy, the RWebLogo was successfully running from the terminal.
Still, the RStudio was throwing a GhostScript error. Omar suggested that there is a problem with an older version of RStudio running on Yosemite (I currently have 10.10.1), and sent me a link to an updated RStudio version where the problem was fixed.
http://www.r-bloggers.com/r-and-rstudio-incompatibility-with-yosemite-mac-os-x-10-10/
I got the updated RStudio and everything works great there right now. Hope this helps someone with a similar issue!

problems with monkeyrunner

I am working on making some changes to the android framework layer and building my own version. I am working based on froyo and trying to use monkeyrunner for some testing. I have pulled the source and can build and run in the emulator but when I try to use a monkeyrunner script I can't seem to get anyhting to work. I built the code using lunch full-eng and it runs fine on the device. I am just trying to get a simple script running based on the example at http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html shown below with a print statement added just to see if I could get anything to run.
/# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
/# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
print "Hello World!"
When the following line is in the script I get an error as follows.
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
Traceback (most recent call last):
File "../../MRTesting/MyTest.py, line 4, in
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
ImportError: cannot import name MonkeyDevice
So if I remove MonkeyDevice from the import as shown below I get a different error on the call to waitForConnection()
from com.android.monkeyrunner import MonkeyRunner
Traceback (most recent call last):
File "../../MRTesting/MyTest.py, line 6, in
device = MonkeyRunner.waitForConnection()
AttributeError: type object 'com.android.monkeyrunner.MonkeyRunner' has no attribute 'waitForConnection'
I tried modifying the call to have some arguments as indicated in the documentation as follows but I still get the same error. The second argument matches the value returned by a call to adb devices.
device = MonkeyRunner.waitForConnection(5, 'emulator-5554')
I have done some digging around and one person said that the shebang needs to be at the beginning of the file as follows with the path modified to avoid putting information in I would rather not share.
/#! /home/<path>/monkeyrunner
I could not see how this would be any different than me invoking monkeyrunner directly from the command line but I tried it and no luck. I did not install the sdk anywhere on my system as it is included in the build tree but it seems to me that the monkeyrunner tool might not be able to locate it as needed but I can't find any indication of how to fix this. I am running the following commands when I build my system from within my build directory at the root.
. build/envsetup.sh
setpaths
lunch full-eng
make -j16
Anyone have any thoughts on this?

Resources