When I open the Scrapy shell through the command scrapy shell "http://quotes.toscrape.com/" (this example comes from the Scrapy tutorial), I enter the command view(response) which opens my navigator (Firefox to be precise) with a path looking like file:///tmp/tmpnzkkilst.html and the error "File not found".
Any idea on how to solve this issue ?
It's not a scrapy but the firefox issue. I experienced the same. Files existed in my /tmp folder, however firefox was unable to open them. In my case the firefox was installed from snap by default and for some reason it could not open the files in /tmp.
Resolved it by downloading and installing the firefox directly from Mozilla's website and replacing the snap one.
Related
I am new in Anaconda (Jupyter Notebbok) and training python. After I installed Anconda when I open Jupyter notebook, the program won't be loaded.
First I run 'jupyter notebook' from the 'command prompt':
Second, when InterneTExplorer loaded and then I click the New>Python3
Finally I expected to have 'jupyter notebook' to write python codes, but I see below picture:
Desired Page:
Can you help me to find the reason for the problem?
In the following link I have attached a video from my Desktop view.
https://www.youtube.com/watch?v=lDvYwHlvghI
Did you try to open the file from the terminal? Create an empty file. In terminal, go to that empty file directory and open that empty file from terminal in Jupyter notebook. Then try to create new .ipynb inside of that file. Just another way to test if it's browser issue or Anaconda download issue.
Command for terminal-
~cd file directory
~jupyter notebook
It will automatically open the Jupyter in your web browser from your terminal.
I copied the 'localhost' link from command prompt in the Firefox browser and solved the problem.
I am using a shared file download service which deletes the file if the file's web page has not been visited in 30 days. I need to store my files for longer than 30 days.
I am using a Centos 7 based Linux server.
My idea was to create a cron to run a bash script with a command line for each file.
I have tried using the wget, curl and lynx commands but these do not register as the page being visited.
Any ideas on a command that I can use?
The file sharing service is gofile.io and an example file I have uploaded (on the page that is required to be visited) is https://gofile.io/?c=znRpuJ
Edit: After looking into it further there appears to be a javascript function which needs to be activated which I think isn't activated by wget/curl/lynx. Is there any way to activate this javascript from the command line?
Try this:
Make sure you have Python3.
Install geckodriver.
pip install selenium for Python3.
Run the following script:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://gofile.io/?c=znRpuJ"
driver.quit()
Good luck.
I use browser-sync in Bash, it doesn't auto-open browser and says [BS] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false) when I type npm start in Angular example.
Of course there's no option to open a browser in limited Linux environment (since no GUI support provided in Bash on Ubuntu on Windows).
If I use Powershell, it's working OK.
My environment: VS Code + Bash on Ubuntu on Windows.
But is there a config or workaround?
So while I kept browsing, i found a clue to the solution of this problem on this webpage https://gist.github.com/Kenty/9096000/revisions which hinted me of where i could find the open option from the error message. I decided to searched for "bs.config.js" on my pc and i found a file called default.config.js in my \Template\node_modules\browser-sync\lib folder under my angular folder and when i searched through the file, i finally found the open option and changed the open option from "local" (which is the default option) to false (Note, it's without the quotes) and when i ran the npm start command again, on the git-bash terminal It worked and there were no more errors.
I am not able to run PhantomJS under cygwin using absolute paths for the argument .js file. Here are the steps I took to setup PhantomJS:
Downloaded PhantomJS 1.9.7 for windows
Copied the PhantomJS executable to c:\cygwin64\bin\
Copied the file "hello.js" from the unzipped PhantomJS download file to my cygwin home directory
Started cygwin/xterm
If I run:
which phantomjs
in my cygwin xterm, it correctly responds with:
/usr/bin/phantomjs
If I run the following from my home directory:
phantomjs hello.js
PhantomJS correctly responds with:
Hello, world!
If I on the other hand run this:
phantomjs /home/user1/hello.js
PhantomJS replies:
Can't open '/home/user1/hello.js'
If I run this:
/usr/bin/phantomjs /home/user1/hello.js
PhantomJS still replies:
Can't open '/home/user1/hello.js'
It does this for every absolute path I try. Why won't PhantomJS work with absolute file paths? The path I showed in my example doesn't have any spaces, special characters, etc., so I'm not sure what the problem could be.
I also tried running the same test in a command prompt under windows and sometimes it would exhibit the same behavior, but not always. I can't seem to reproduce this error under windows anymore so I'm not sure what else to say about that.
Does anyone know what the problem could be?
I found the solution. Running native windows programs through cygwin requires you to convert cygwin's POSIX paths to Windows-style paths. In my example above, the following works:
phantomjs "`cygpath -w /cygdrive/c/cygwin64/home/user1/hello.js`"
returns:
Hello, world!
I am not yet sure what the backticks are for, but at least I found the solution.
I have installed firewatir 1.8.0, jssh 0.9 addon.
Do I need to open the firefox browser manually from the command prompt with -jssh extension every time I want to run the tests in firefox?
When I try to run the tests without manually opening the browser I am getting the following error:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/firewatir-1.8.0/lib/firewatir/firefox.rb:156:in `rescue in set_defaults': Unable to connect to machine : 127.0.0.1 on port 9997. Make sure that JSSh is properly installed and Firefox is running with '-jssh' option(Watir::Exception::UnableToStartJSShException)
Also I tried running the tests by changing the path from "C:\Program Files\Mozilla Firefox\firefox.exe" to "C:\Program Files\Mozilla Firefox\firefox.exe" -jssh in the Target text box of the Mozilla Firefox Properties window.
Yes see here fore more info
You will need to open Firefox using acommand line argument to get FireWatir to recognize jssh. To do this, open your command prompt, or a terminal, and run:
firefox.exe -jssh
or
./firefox-bin -jssh
from the appropriate folder, depending on your platform.
i'd also encourage you to look at watir-webdriver as an alternative. Ongoing development of JSSH/firewatir is doubtful for Firefox 4 and beyond. Watir-webdriver is looking like the way to go, especially if you're just starting out.
When running on my Mac the WATIR test starts Firefox with the JSSH automatically, but usually this takes longer to start than the connection timeout in the script.
So it is easier to start it manually before running the scripts.