Closed Mavericks334 closed 3 years ago
Hi Ren, it looks like for some reason, the web-traffic is blocked to download from the github.com URL directly.
Can you tell me what happens if you run below and why you included the part on SSL in your sample code above?
import rpa as r
r.init()
r.url('https://ca.yahoo.com')
r.close()
The auto-setup uses download() function which is using Python built-in functions to download files -
if _python2_env():
import urllib; urllib.urlretrieve(download_url, filename_to_save)
else:
import urllib.request; urllib.request.urlretrieve(download_url, filename_to_save)
From above error message the error is HTTP Error 403: Forbidden
, so this can either be from your company, or country that is blocking such access or could be GitHub.com for some reason blocking access from your network / laptop.
Can you share more about in which country you are using this and is this your work or personal laptop? I know for some China users or some companies their access is blocked. The exact URL endpoint is below for Windows -
https://github.com/tebelorg/Tump/releases/download/v1.0.0/TagUI_Windows.zip
Hi @kensoh ,
When i use this code
import tagui as t
tagui_zip_file = 'TagUI_Windows.zip'
tagui_zip_url = 'https://github.com/tebelorg/Tump/releases/download/v1.0.0' + tagui_zip_file
import os
home_directory = os.path.expanduser('~')
download_url = tagui_zip_url
filename_to_save = home_directory + '/' + tagui_zip_file
if t._python2_env():
import urllib; urllib.urlretrieve(download_url, filename_to_save)
else:
import urllib.request; urllib.request.urlretrieve(download_url, filename_to_save)
Below is my error. I'm logged in to my company network
HTTPError Traceback (most recent call last)
<ipython-input-20-db12ba0a1d93> in <module>
12 import urllib; urllib.urlretrieve(download_url, filename_to_save)
13 else:
---> 14 import urllib.request; urllib.request.urlretrieve(download_url, filename_to_save)
C:\ProgramData\Anaconda3\lib\urllib\request.py in urlretrieve(url, filename, reporthook, data)
245 url_type, path = splittype(url)
246
--> 247 with contextlib.closing(urlopen(url, data)) as fp:
248 headers = fp.info()
249
C:\ProgramData\Anaconda3\lib\urllib\request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
220 else:
221 opener = _opener
--> 222 return opener.open(url, data, timeout)
223
224 def install_opener(opener):
C:\ProgramData\Anaconda3\lib\urllib\request.py in open(self, fullurl, data, timeout)
529 for processor in self.process_response.get(protocol, []):
530 meth = getattr(processor, meth_name)
--> 531 response = meth(req, response)
532
533 return response
C:\ProgramData\Anaconda3\lib\urllib\request.py in http_response(self, request, response)
639 if not (200 <= code < 300):
640 response = self.parent.error(
--> 641 'http', request, response, code, msg, hdrs)
642
643 return response
C:\ProgramData\Anaconda3\lib\urllib\request.py in error(self, proto, *args)
567 if http_err:
568 args = (dict, 'default', 'http_error_default') + orig_args
--> 569 return self._call_chain(*args)
570
571 # XXX probably also want an abstract factory that knows when it makes
C:\ProgramData\Anaconda3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
501 for handler in handlers:
502 func = getattr(handler, meth_name)
--> 503 result = func(*args)
504 if result is not None:
505 return result
C:\ProgramData\Anaconda3\lib\urllib\request.py in http_error_default(self, req, fp, code, msg, hdrs)
647 class HTTPDefaultErrorHandler(BaseHandler):
648 def http_error_default(self, req, fp, code, msg, hdrs):
--> 649 raise HTTPError(req.full_url, code, msg, hdrs, fp)
650
651 class HTTPRedirectHandler(BaseHandler):
HTTPError: HTTP Error 403: Forbidden
Regards, Ren.
Do i have an alternate way to avoid the download. By placing the folder after manual downloads
Thanks for your detailed troubleshooting, yes from above it looks confirmed due to network access issue.
There are 2 ways -
Are you able to download that zip file manually to your laptop? If yes, you can unzip it on your computer somewhere. For example %APPDATA%. This will create a tagui folder. You can also try unzipping it on your desktop. Then, before running r.init(), you do r.tagui_location('full_path_of_parent_folder')
to set a custom directory to run TagUI. For eg r.tagui_location('c:\\somewhere\\desktop')
. This way, RPA for Python will use your local copy instead of grabbing from the cloud. However for this way, there may be some updates which still tries to grab from the cloud and you have to manually download the few files to make it work.
The second way is easier, if you are able to copy files from your personal laptop to the work laptop. You can pip install rpa
on your local laptop. Then you do r.pack()
and it will create a zip file and a python file for you to copy to your company laptop to use. Due to company laptop restriction, this method can run without internet or pip on your computer laptop. You can straightaway do import rpa as r
to import the generated rpa.py
file into your Python script.
Hi @kensoh,
I was able to download the file and also install rpa in my office system using pip without any issues. However. This is the issue that still comes up. I tried the parent folder for named as python automations and the error is the same.
import rpa as r
r.tagui_location(r'C:\Python Automations\TagUI_Windows\tagui')
r.init()
r.url('https://ca.yahoo.com')
r.close()
Error
[RPA][INFO] - setting up TagUI for use in your Python environment
[RPA][INFO] - downloading TagUI (~200MB) and unzipping to below folder...
[RPA][INFO] - C:\Python Automations\TagUI_Windows\tagui
[RPA][ERROR] - failed downloading from https://github.com/tebelorg/Tump/releases/download/v1.0.0/TagUI_Windows.zip...
HTTP Error 403: Forbidden
[RPA][ERROR] - use init() before using url()
[RPA][ERROR] - use init() before using close()
False
Regards, Ren.
Hi Ren, the parent folder should be below, you can try below -
r.tagui_location(r'C:\Python Automations\TagUI_Windows')
You may still get some error messages while syncing some new files though which requires manual downloads. You can download all the files from here to overwrite your copy - https://github.com/tebelorg/Tump/tree/master/TagUI-Python
As a last step, you need to create a dummy blank rpa_python_1.43.0
file under your TagUI_Windows\tagui folder, this will let the package know that you are running the latest version so that it won't try to download anything again.
Thank you for the update @kensoh . The rpa_python file with what extension do i need to save it.
That file no extension, it is just a marker file for the package to detect that it has the latest updated files from -
Hi @kensoh ,
This is the error i get.
code is
import rpa as r
r.tagui_location(r'C:\Python Automations\TagUI_Windows')
r.init()
r.url('https://ca.yahoo.com')
r.close()
[RPA][INFO] - setting up TagUI for use in your Python environment
[RPA][INFO] - downloading TagUI (~200MB) and unzipping to below folder...
[RPA][INFO] - C:\Python Automations\TagUI_Windows
[RPA][ERROR] - failed downloading from https://github.com/tebelorg/Tump/releases/download/v1.0.0/TagUI_Windows.zip...
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)>
[RPA][ERROR] - use init() before using url()
[RPA][ERROR] - use init() before using close()
Regards, Ren.
Hi Ren,
Hi @kensoh same error
Regards, Ren.
I can't understand why on your system, the package still tries to download when the files are there. Can you try running manually few lines of code below until os.path.isfile() to find out why Python is routing to setup()?
https://github.com/tebelorg/RPA-Python/blob/cd809146341048a7368677c1129d9e2faf9c2f6f/tagui.py#L447
This is what i get. I tried it one by giving the location and one without the location and the error is the same.
Regards, Ren.
Oh Ren, now it is calling using as an import, so you have to do r.tagui_location() to access the function.
If this approach is too troublesome, I encourage you to try the 2nd approach below which the package is already designed for. By using pack() and update(), all this downloading and updating files can be automatically managed. All that is needed is for you to be able to bring in the generated .zip and .py file into your work computer from your personal computer.
https://github.com/tebelorg/RPA-Python/issues/287#issuecomment-888735714
Hi @kensoh ,
I was able to use r.pack() on the 2nd attempt on my personal laptop. Will save the files the above folders and try it again
Regards, Ren.
Oh sure, let me know how it goes! After using r.pack() you can put the rpa.py file and the zip file anywhere. Then do import rpa as r
and r.init()
and the rest will be taken care of. You will need the rpa.py file in the same folder as the Python script that requires this package, because this mode assumes no internet access to use pip install rpa.
Hi @kensoh.
Below is the path i placed the files.
and the code i still get this error.
Do i need to change the file path or do something else.
Regards, Ren.
You just do above - https://github.com/tebelorg/RPA-Python/issues/287#issuecomment-892012502
Start Jupyter notebook from the folder where you put the rpa.py, it will be the one to be used -
import rpa as r
r.init
@kensoh This is my jupyter folder from where it starts
The error is the same like earlier.
Path where i placed the rpa.py and the zip file. Even placed it in nbconfig folder and the error is the same.
Regards, Ren.
See below, this is the folder where you start jupyter notebook. Try putting the rpa.py and zip file there -
And try starting with just jupyter notebook
in that folder
It works like a charm. Thank you for all the assistance.
Closing this request. Thank you.
Welcome! Feel free to join TagUI / RPA for Python Telegram group and post questions there if run into anything. I'll answer and also other experienced folks from community will share their experiences -
just let your python visit github maybe you need some code like this:
import os
proxy = 'http://127.0.0.1:9999'
os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy
Hi @kensoh ,
Below is the error i get when i use the code in Windows.
Regards, Ren.