Using __init__.py

2017-09-06 Thread Kryptxy via Python-list
I am working on a (cross-platform) project. On linux system, the imprts work 
fine, but in windows I get imort error (I have no idea why. I tried searching 
everywhere, but couldn't get it to work).
Anyways, the issue seem to be resolved by adding project directory to 
sys.path().

I wanted to know that can I use __init__.py file for adding a project directory 
to sys.path (sys.path.insert(0, directory))?
-- 
https://mail.python.org/mailman/listinfo/python-list


Torrench - Torrent search made simple

2017-09-10 Thread Kryptxy via Python-list
Torrench: Command-line torrent search program (cross-platform). Torrent search 
made quick and simple.

GitHub: https://github.com/kryptxy/torrench

Suggestions/feedbacks are highly appreciated.
-- 
https://mail.python.org/mailman/listinfo/python-list


Change project licence?

2017-09-14 Thread Kryptxy via Python-list
Hi,
I have an opensource (python) project under GPL3 licence. I wish switch to MIT 
licence so as to make it more permissive.
I know how to change the licence, but I want to know is it fine and wise to 
change the licence at this point?
(The project already has 19 clones, 250+ GitHub stars. Here: 
https://github.com/kryptxy/torrench)

Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Change project licence?

2017-09-23 Thread Kryptxy via Python-list
Thank you all! I opened a ticket about the same (on github).
I got response from most of them, and all are agreeing to the change.
However, one contributor did not respond at all. I tried e-mailing, but no 
response.
Can I still proceed changing the licence? It has been more than a week since 
the ticket was opened.

Sent with [ProtonMail](https://protonmail.com) Secure Email.

>  Original Message 
> Subject: Re: Change project licence?
> Local Time: 15 September 2017 5:54 AM
> UTC Time: 15 September 2017 00:24
> From: ros...@gmail.com
> To: python-list@python.org 
>
> On Fri, Sep 15, 2017 at 10:17 AM, Ben Finney  
> wrote:
>>> I know how to change the licence, but I want to know is it fine and
>>> wise to change the licence at this point? (The project already has 19
>>> clones, 250+ GitHub stars. Here: https://github.com/kryptxy/torrench)
>>
>> Those represent a whole lot of recipients, who received GPLv3-or-later
>> license grant, guaranteeing the freedom of the work for all recipients
>> in all modified forms. I would consider it poor form to allow non-free
>> redistribution at this point.
>
> Those recipients can still do everything they previously could,
> *including redistributing the code under the GPLv3*. They have lost
> nothing.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Change project licence?

2017-09-23 Thread Kryptxy via Python-list
Yep. I will wait for a response. Thank you!

 Original Message 
On 23 Sep 2017, 16:57, Chris Angelico wrote:

> On Sat, Sep 23, 2017 at 7:44 PM, Leam Hall  wrote:
>> Like Chris said, evaluate the level of effort on the code. Wait, or replace.
>> You will be happier when you take the honorable path.
>
> Remembering that that, of course, is Plan B; plan A is to keep trying
> to contact that last contributor.. S/he hasn't refused, so there's
> still every possibility of getting that last okay.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list @gmail.com>
-- 
https://mail.python.org/mailman/listinfo/python-list


Running a GUI program haults the calling program (linux)

2017-09-25 Thread Kryptxy via Python-list
I want to run a GUI program (transmission-gtk) from python. This is what I do:

import subprocess
subprocess.Popen(['transmission-gtk', link], stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)

Where `link` is some magnetic link.

This command opens transmission-gtk, but it haults the calling program, and 
keeps the terminal busy till the time GUI is running.
As soon as GUI is closed, the control goes back to the program.

Is there any way that the GUI program is opened, and immediately the control 
returns to calling program, instead of keeping the terminal busy?

(I know transmission-remote can be used for adding torrents. Looking for a way 
around for transmission-gtk specifically).

Thank you!
Regards.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Running a GUI program haults the calling program (linux)

2017-09-26 Thread Kryptxy via Python-list
Sent with [ProtonMail](https://protonmail.com) Secure Email.

>  Original Message 
> Subject: Re: Running a GUI program haults the calling program (linux)
> Local Time: 26 September 2017 6:20 AM
> UTC Time: 26 September 2017 00:50
> From: ros...@gmail.com
> To: python-list 
>
> On Tue, Sep 26, 2017 at 10:38 AM, Kryptxy via Python-list
>  wrote:
>> I want to run a GUI program (transmission-gtk) from python. This is what I 
>> do:
>>
>> import subprocess
>> subprocess.Popen(["transmission-gtk", link], stdout=subprocess.PIPE, 
>> stderr=subprocess.PIPE)
>>
>> Where `link` is some magnetic link.
>>
>> This command opens transmission-gtk, but it haults the calling program, and 
>> keeps the terminal busy till the time GUI is running.
>> As soon as GUI is closed, the control goes back to the program.
>>
>> Is there any way that the GUI program is opened, and immediately the control 
>> returns to calling program, instead of keeping the terminal busy?
>>
>> (I know transmission-remote can be used for adding torrents. Looking for a 
>> way around for transmission-gtk specifically).
>
> I"m not sure why you can"t signal it, but I"ll take that parenthesized
> comment as an indication that you know about (a) the
> transmission-remote command, and/or (b) the fact that transmission-gtk
> can be remote-controlled fairly effectively. (For instance, I have a
> script that puts Transmission into turtle mode, then does something,
> and then takes Transmission out of turtle mode. It"s two lines of
> shell script to do it.)

Yes I know about transmission-remote. I am trying to figure out a way for 
running transmission-gtk without causing program to hault.

> So, you want to "fire-and-forget" a GUI program. Or more generally,
> _any_ program. My suspicion here is that, since Popen shouldn"t be
> blocking, that you"re filling up one of your pipes. Can you try
> removing the stdout and stderr parameters, and see what that does? You
> should be able to fire off a subprocess and then carry on with the
> program. It might make a lot of noise, if transmission produces a ton
> of output; but if that happens, try std{out,err}=subprocess.DEVNULL
> instead of PIPE - unless you"re specifically trying to read the
> output?

Tried std{out,err}=subprocess.DEVNULL - Did not work. The program still haults.

Also, worth noting that the program haults when transmission-gtk is opened for 
the first time.
Suppose if the GUI windows is already open, and then subprocess.Popen() is run,
the torrent is added successfully, and control goes back to calling program. 
(That is the program does not hault).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Running a GUI program haults the calling program (linux)

2017-09-26 Thread Kryptxy via Python-list
Sent with [ProtonMail](https://protonmail.com) Secure Email.

>  Original Message 
> Subject: Re: Running a GUI program haults the calling program (linux)
> Local Time: 26 September 2017 12:09 PM
> UTC Time: 26 September 2017 06:39
> From: c...@cskk.id.au
> To: Kryptxy 
> python-list 
>
> On 25Sep2017 20:38, Kryptxy  wrote:
>>I want to run a GUI program (transmission-gtk) from python. This is what I do:
>>
>>import subprocess
>>subprocess.Popen(["transmission-gtk", link], stdout=subprocess.PIPE, 
>>stderr=subprocess.PIPE)
>>
>>Where `link` is some magnetic link.
>>
>>This command opens transmission-gtk, but it haults the calling program, and 
>>keeps the terminal busy till the time GUI is running.
>>As soon as GUI is closed, the control goes back to the program.
>
> I do not believe this is all your code. Please post a _complete_ example.
>
> Popen dispatches a process. It does not wait for it to terminate. GUI programs
> are not special. Therefore, if your calling python program is blocking, it is
> blocking somewhere other that this line of code. Please show us where.
>
> Consider putting print() calls through your code to locate where your program
> stalls.
>
> Cheers,
> Cameron Simpson  (formerly c...@zip.com.au)

Here -

p = subprocess.Popen(['transmission-gtk', link], stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
output, error = p.communicate()
error = error.decode('utf-8')
output = output.decode('utf-8')
if error != '':
print("\nUnable to load torrent.")
else:
print("Torrent added successfully!")

Here, transmission-gtk is opened and the program haults (at subprocess.Popen() 
statement).
When I close the GUI window, I get the message "Unable to load torrent".

Error message I get:
`Unable to parse nameserver address 8.8.8.8,`
`(transmission-gtk:3982): GLib-CRITICAL **: g_file_test: assertion 'filename != 
NULL' failed`
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Running a GUI program haults the calling program (linux)

2017-09-26 Thread Kryptxy via Python-list
>  Original Message 
> Subject: Re: Running a GUI program haults the calling program (linux)
> Local Time: 26 September 2017 1:26 PM
> UTC Time: 26 September 2017 07:56
> From: __pete...@web.de
> To: python-list@python.org
>
> Kryptxy via Python-list wrote:
>
>> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>>
>>>  Original Message 
>>> Subject: Re: Running a GUI program haults the calling program (linux)
>>> Local Time: 26 September 2017 12:09 PM
>>> UTC Time: 26 September 2017 06:39
>>> From: c...@cskk.id.au
>>> To: Kryptxy 
>>> python-list 
>>>
>>> On 25Sep2017 20:38, Kryptxy  wrote:
>>>>I want to run a GUI program (transmission-gtk) from python. This is what
>>>>I do:
>>>>
>>>>import subprocess
>>>>subprocess.Popen(["transmission-gtk", link], stdout=subprocess.PIPE,
>>>>stderr=subprocess.PIPE)
>>>>
>>>>Where `link` is some magnetic link.
>>>>
>>>>This command opens transmission-gtk, but it haults the calling program,
>>>>and keeps the terminal busy till the time GUI is running. As soon as GUI
>>>>is closed, the control goes back to the program.
>>>
>>> I do not believe this is all your code. Please post a _complete_ example.
>>>
>>> Popen dispatches a process. It does not wait for it to terminate. GUI
>>> programs are not special. Therefore, if your calling python program is
>>> blocking, it is blocking somewhere other that this line of code. Please
>>> show us where.
>>>
>>> Consider putting print() calls through your code to locate where your
>>> program stalls.
>>>
>>> Cheers,
>>> Cameron Simpson  (formerly c...@zip.com.au)
>>
>> Here -
>>
>> p = subprocess.Popen(["transmission-gtk", link], stdout=subprocess.PIPE,
>> stderr=subprocess.PIPE)
>> output, error = p.communicate()
>
> That"s the problem. communicate() *must* block to collect the program"s
> entire output. You get what you ask for...

Thanks! It worked!
-- 
https://mail.python.org/mailman/listinfo/python-list


Need some help with argparse

2017-10-03 Thread Kryptxy via Python-list
Hi,
I am trying to figure out something with argparse.
Here is a scenario:

I have a group of arguments, say: (-a, -b, -c, -d, -e) [lets call it group1]
I have another group, say: (-z, -y, -x, -w) [lets call it group2]

Code:
import argparse
parser = argparse.ArgumentParser(description="Test this shiz")
group1= parser.add_argument_group("Group 1")
group2= parser.add_argument_group("Group 2")

group1.add_argument('-a', '--extendA', action="store_true", help="HELP")
group1.add_argument('-b', '--extendB', action="store_true", help="HELP")
group1.add_argument('-c', '--extendC', action="store_true", help="HELP")
group1.add_argument('-d', '--extendD', action="store_true", help="HELP")
group1.add_argument('-e', '--extendE', action="store_true", help="HELP")

# Similarly for group 2:
group2.add_argument('-z', '--extendZ', action="store_true", help="HELP")
group2.add_argument('-y', '--extendY', action="store_true", help="HELP")
group2.add_argument('-x', '--extendX', action="store_true", help="HELP")
group2.add_argument('-w', '--extendW', action="store_true", help="HELP")

args = parser.parse_args()

Now I want to get arguments of group1 and group2 separately.
If I print(args) - I get arguments from both the groups.
Also group1.parse_args() does not work (since ArgumentGroup does not have 
parse_args() method)

How can I get all arguments of group 1 ONLY? Same goes for group 2?
I tried subparsers too - but they require a mandatory `positional argument` - 
which is not application's requirement.

Any kind of help is appreciated.
Thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to Generate dynamic HTML Report using Python

2017-11-19 Thread Kryptxy via Python-list
I have a piece of code (module) implementing dynamic html page generation. What 
it simply does is writes all the html content (tags + data) to a file, and the 
file is save with a (.html) extension. Served my purpose. Not really sure is 
this is something you are looking for.

You can view the code here: 
https://github.com/kryptxy/torrench/blob/master/torrench/modules/tpb_details.py

Hope this helps.

 Original Message 
On 20 Nov 2017, 6:46 AM, mradul dhakad wrote:

> Hi All ,
>
> I am new to python . I am trying to generate Dynamic HTML report using
> Pyhton based on number of rows selected from query .Do any one can suggest
> some thing for it.
>
> Thanks,
> Mradul
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request fails on wikipedia (https) - certificate verify failed (_ssl.c:748)

2017-12-11 Thread Kryptxy via Python-list
Install pyopenssl package and try again?
 Original Message 
On 11 Dec 2017, 16:44, F Massion wrote:

> Hi,
>
> I would like to get information from Wikipedia articles and I am testing the 
> connection to Wikipedia.
>
> I am running Python 3.6.2 on Windows 10.
>
> I get certificate errors for all pages with https.
> Any suggestions are welcome!
>
> Here my code:
>
> import requests, bs4
> from bs4 import BeautifulSoup
> res = requests.get('https://en.wikipedia.org/wiki/Stethoscope')
> type(res)
> res.status_code == requests.codes.ok
> wiki = bs4.BeautifulSoup(res.text)
> type(wiki)
> len(res.text)
> print(res.text[:250])
>
> Here the error message:
>
> Traceback (most recent call last):
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 601, in 
> urlopen
> chunked=chunked)
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 346, in 
> _make_request
> self._validate_conn(conn)
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 850, in 
> _validate_conn
> conn.connect()
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\urllib3\connection.py", line 326, in 
> connect
> ssl_context=context)
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\urllib3\util\ssl_.py", line 329, in 
> ssl_wrap_socket
> return context.wrap_socket(sock, server_hostname=server_hostname)
> File "c:\Program Files (x86)\Python36-32\lib\ssl.py", line 401, in wrap_socket
> _context=self, _session=session)
> File "c:\Program Files (x86)\Python36-32\lib\ssl.py", line 808, in __init__
> self.do_handshake()
> File "c:\Program Files (x86)\Python36-32\lib\ssl.py", line 1061, in 
> do_handshake
> self._sslobj.do_handshake()
> File "c:\Program Files (x86)\Python36-32\lib\ssl.py", line 683, in 
> do_handshake
> self._sslobj.do_handshake()
> ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
> (_ssl.c:748)
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\requests\adapters.py", line 440, in send
> timeout=timeout
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\urllib3\connectionpool.py", line 639, in 
> urlopen
> _stacktrace=sys.exc_info()[2])
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\urllib3\util\retry.py", line 388, in 
> increment
> raise MaxRetryError(_pool, url, error or ResponseError(cause))
> urllib3.exceptions.MaxRetryError: 
> HTTPSConnectionPool(host='en.wikipedia.org', port=443): Max retries exceeded 
> with url: /wiki/Stethoscope (Caused by SSLError(SSLError(1, '[SSL: 
> CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)'),))
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "web_1.py", line 3, in
> res = requests.get('https://en.wikipedia.org/wiki/Stethoscope')
> File "c:\Program Files (x86)\Python36-32\lib\site-packages\requests\api.py", 
> line 72, in get
> return request('get', url, params=params, **kwargs)
> File "c:\Program Files (x86)\Python36-32\lib\site-packages\requests\api.py", 
> line 58, in request
> return session.request(method=method, url=url, **kwargs)
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\requests\sessions.py", line 508, in 
> request
> resp = self.send(prep, **send_kwargs)
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\requests\sessions.py", line 618, in send
> r = adapter.send(request, **kwargs)
> File "c:\Program Files 
> (x86)\Python36-32\lib\site-packages\requests\adapters.py", line 506, in send
> raise SSLError(e, request=request)
> requests.exceptions.SSLError: HTTPSConnectionPool(host='en.wikipedia.org', 
> port=443): Max retries exceeded with url: /wiki/Stethoscope (Caused by 
> SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify 
> failed (_ssl.c:748)'),))
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: py2exe maintainer abandoned the project; is there any replacements? Or, anyone willing to continue the work?

2018-02-21 Thread Kryptxy via Python-list
I like pyinstaller. It's one-file exe creation is pretty good. You can give it 
a try.

 Original Message 
On 21 Feb 2018, 23:00, MGHSM wrote:

> Am 21.02.18 um 18:30 schrieb MGHSM: > Thomas Heller himself says he's 
> "retiring" from py2exe in 
> https://sourceforge.net/p/py2exe/mailman/message/36033869/ > > Is there any 
> suitable replacement with similar or better capabilities? > There is 
> PyInstaller, which works on all major OS: http://www.pyinstaller.org/ 
> Christian -- https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Will my project be accepted in pypi?

2017-07-26 Thread Kryptxy via Python-list
Hello,
I have built a command-line torrent fetching tool. The tool fetches torrents 
from thepiratebay proxy sites, and display results in console. Its written in 
python3, and is completely open-source.

Project link - https://github.com/kryptxy/torrench
(You may give it a try :p)

Question: (a) Can I publish such tool on pypi?
(b) Also, should I publish it on pypi?

I ask (b) as the packages I used from pypi (pip) were more like utility 
packages. They helped me in building my project. My project, on the other end 
is a full-fledged tool. So should I publish it on pypi?

I ask (a) because the tool scraps TPB proxies, which aren't legal per se. So if 
I package and publish this tool, will it be accepted?

If someone could assist me with this?
Thank you.

Regards,
Rijul Gulati
-- 
https://mail.python.org/mailman/listinfo/python-list


Need some advice please

2017-07-29 Thread Kryptxy via Python-list
Hello,
I have developed a python program (tool) that fetches torrents from 
thepiratebay proxy sites and displays results in console/terminal window.

Here: github.com/kryptxy/torrench

Now, since thepiratebay contains illegal content, I am restricted from 
packaging this tool for other distros (Eg. AUR).

As of now, the website (https://proxybay.one/) (which consists of tpb proxy 
site list) is hard-coded in find_url.py file.
Now to bypass any legalities, I am thinking of providing a configuration file, 
that consists of the website's url, along with an enabling switch.
The configuration file will NOT be hosted on github (means it will not be 
provided with package). Instead, the user will have to download the config file.
If config file is configured, tool will work. Else it would prompt to configure 
the file.

Would it get me around legal issues, that is making this tool completely legal?

I could really use sone advice here.

Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Command-line torrent search tool (windows/linux)

2017-08-02 Thread Kryptxy via Python-list
Torrench - A Command-line torrent search tool - For windows and Linux OS

The tool fetches torrents from existing torrent-hosting sites.

Websites supported:
1. linuxtracker.org - Get linux distros ISO torrents
2. ThePirateBay - Do read usage instructions.

Project is in python3, and is completely open-source.

Project link: https://github.com/kryptxy/torrench

I plan on hosting it on pypi as well as AUR (Arch User repository) :)

Hope you like this tool, and find it useful.
Feedback/suggestions are highly appreciated.
-- 
https://mail.python.org/mailman/listinfo/python-list


Package not visible/available on pypi

2017-08-05 Thread Kryptxy via Python-list
I had recently uploaded a package on pypi. For some reason, I removed the 
package, and committed a BIG mistake along the way.
I clicked the DELETE PACKAGE [Warning about NEVER TO CLICK THAT BUTTON] (silly 
me!)
Now, after re-uploading the package, its not visible on pypi.
How can I fix this? I already have uploaded the package. But it's not visible 
on pypi (neither under packages in my dashboard).
-- 
https://mail.python.org/mailman/listinfo/python-list


Need some help managing project and making it a little simple (pretty messed up code)

2017-08-16 Thread Kryptxy via Python-list
Hello,
I am new to python. While learning python, I began a side project. Its a 
command-line search program.

Here: https://github.com/kryptxy/torrench

The project is becoming a little difficult to manage, and before it becomes 
more complex, I'd like to sort it out a little and make it more managable and 
readable.
As of now, I haven't used any OOP concepts (no classes) bc while I was 
learning, I didn't reach the OOP part, and then spent too much time on the 
project (and that's probably the part I want help with). Now however, I do know 
about classes and basics about OOP.

But, I am unable to understand how I should begin structuring the project 
(updating code according to OOP). If someone could have a look? Could really 
use some suggestions/ideas.

Also, can someone point me to some (small) project where something similar is 
being implemented? (as in sharing similar project-structure). They can be 
really helpful. I did have a look at youtube-dl source. Not helpful. Seemed too 
complex.

Hope for some positive response.

Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list