It's the first time I am using colab notebook. I write the code and when I try to execute it using ctrl+ enter key it runs but doesn't display output.
Google provides Jupyter Notebook like interface to run Python code on online Virtual Machines. In this article, we will see how to run simple Python code on Google Colab.
Step #1: Open colab
Step #2: Select New Python3 Notebook
Step #3: Start Typing code into the code cells.
Step #4: To add new cell, click on Insert->Code Cell
Step #5: To run a particular cell, select the cell and press Ctlr + ENTER keys.
Output after successful run
Related
my question is similar to this queation but the answer of that doesn't work for me.On that answer he said just click on the "Mount Drive" button. But when I clicked the new cell appears in my code like this. and when I run this cell, It wants me authorization code again!. What should I do?
Create a new notebook, and copy and paste all of the cells from the source notebook there.
The automatic Drive mounting feature requires notebooks that are not shared or modified by others. So, my guess is that the original notebook you are trying to use is shared or is a copy of a notebook authored by others.
I am running a long hyperparameter tuning using TensorFlow on google colab (GPU runtime), which is expected to take a few hours.
However, after over half an hour of training, the "Run cell" button turns from grey to red, with the message reading "Run cell\ cell has not been executed in this session\ executed at unknown time" and the values stop from printing in the output cell. The kernel is probably still running since I can't execute any other cell (the run cell button keeps rotating).
Why is this problem happening?
Is there a way to prevent this from happening?
If not, is there a way to measure the progress of the hyperparameter tuning given that the notebook stops from printing any outputs?
Thanks a lot.
Automatic inputs in Chromium are filled randomly
CASE
I want to simulate a barcode scanner without any hardware attached to my computer. From what I learnt, barcode scanners behave as keyboards, so I want to simulate a keyboard HID device.
ENVIRONMENT
Chromium version 53.0.2785.143 Built on Ubuntu , running on LinuxMint 17.2 (64-bit)
ATTEMPTS
1) evdev in python
2) write into dev/input/event* using C++
3) pyautogui
Attempts 1 and 2 behave similarly. Both try to write into dev/input/event* file which corresponds to computer keyboard. But for multiple keypress in loop, the result is not what I expect: if I simulate a keypress repetition, the result goes randomly. Furthermore, some keyboard keys start printing another character which does not correspond to them until the terminal is closed.
So I went with attempt 3 which prints what I want, but the result goes randomly in Chromium.
PROBLEM
pyautogui works in Firefox, but writes randomly inputs in Chromium. It looks like Chromium are avoiding automatic input in its input forms in any website.
Python program:
import pyautogui
pyautogui.typewrite('1234567890123\n', interval=0)
Example
It prints 1234567890123 in Firefox;
It prints 2413123098765 in Chromium. #Random number of 13 digits
QUESTION
Does anybody know why Chromium behaves like that?
On windows 10.
I need to automate the repeated process of these steps.
1. Open up an image in GIMP. Scale it to 110%.
2. Export as somefile name(for example input001.jpg).
3. Go to http://deepdreamgenerator.com/ in a browser. click on button, browse to the exported file.
4. Wait for it to generate result, save image as result file (for example dream001.jpg).
then repeat from step 1 with the result file from step 4...but keep increasing the filename number so export it as input002.jpg...
What software would allow me to do this?
the only software i know of that * MIGHT * be able to automate that process is AutoHotKey
You would need to keep the windows which you're automating static (ie. make sure they don't move) and then write keyboard and mouse macros in autohotkey to press the buttons and do the things you want.
I tried AutoHotKey but didn't feel like learning a whole new scripting language so I found something simpler called GhostMouse.
It just has record,play,stop buttons.
after recording and closing out of program it asks if i want to save script. clicked yes gave it a name, and then edited the script file..and copied and pasted as many times as i wanted the script to run (before copying and pasting i deleted the last 3 lines which has to do with clicking the stop button which i didn't want the script to do).
You can also try Sikuli for same. It's an image comparator
http://www.sikuli.org/
Reference :-
http://doc.sikuli.org/tutorials/
I am using selenium IDE 1.10.0. I am trying to check presence of image in product categories. what command should i use to verify image?
Open selenium IDE in FF browser
Right click on the image, then you see assertelementpresent command, if you do not see this command then hover over Show all available command and select assertelementpresent
Check image
try using
assertElementPresent //img
The second is xpath relative to image
Best way how to find out for yourself:
Open Selenium IDE addon
Right click the element you want to check
Hover Show all available commands
Try to find most suitable command
use that command and see what happens
There are 3 ways of doing that depending on your task (why you need this image):
1) you may wait for the image to perform some actions (e.g. wait for the button to click it): waitForElementPresent(locator). It uses timeout set in your Selenium IDE.
So when element appears, your script will execute next line. If it does not appear - this case should be processed somehow (e.g. using verify - see item 2)
2) if you need to know if image is there - you may use verifyElementPresent(locator) - it returns true or false (and you may store this value). If image is not present - test will continue running (this is important!)
3) if this image is critical - use what was suggested here already: assertElementPresent(locator) - if image is not there test will stop.
P.s. I hope you know what locator means. If not - find samples, it is easy