RE: Python application launcher (for Python code)

2017-02-25 Thread Deborah Swanson
Dennis Lee Bieber wrote, on February 25, 2017 4:50 AM
> 
> On Fri, 24 Feb 2017 22:26:15 -0800, "Deborah Swanson" 
>  declaimed the following:
> 
> >
> >Well rats. Skull duggery on the net is a lot more sophisticated than 
> >when I saw it last (15 years ago). Getting up to speed with it is on
my 
> >list, but quite aways down.  Best strategy is to only plan on using
it 
> >a few times and then uninstall. Maybe restore that install from a
drive 
> >backup if I need it again, then overwrite with an up to date backup.
> >
>   Probably won't help... There's likely some cryptic 
> registry entry encoding the date of last "phone home" (and 
> maybe number of times started since that date too). If it's 
> by date, you'd have to fake the date on the computer (I 
> wouldn't be surprised if the first thing it does is ensure 
> NTP sync is on, and run a time-server sync). If, in 
> association, there is a use counter, you'd have to restore an 
> earlier value of the registry.
> 
>   And I'm quite certain M$ uninstall won't remove the 
> registry entries of usage, just so a reinstall (or restore 
> from backup) can't bypass the system.
> 
> -- 
>   Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/

Didn't think of that one either, but it's easy to export the involved
keys right after installing and restore them before each use.

I like the idea of pulling the wire (cutting internet access) when I use
it. Then nobody (including the app) is getting in or out to look at or
do anything while the app is running. I won't use it much or often.

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


Re: Python replace multiple strings (m*n) combination

2017-02-25 Thread INADA Naoki
If you can use third party library, I think you can use Aho-Corasick algorithm.

https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm

https://pypi.python.org/pypi/pyahocorasick/

On Sat, Feb 25, 2017 at 3:54 AM,   wrote:
> I have a task to search for multiple patterns in incoming string and replace 
> with matched patterns, I'm storing all pattern as keys in dict and 
> replacements as values, I'm using regex for compiling all the pattern and 
> using the sub method on pattern object for replacement. But the problem I 
> have a tens of millions of rows, that I need to check for pattern which is 
> about 1000 and this is turns out to be a very expensive operation.
>
> What can be done to optimize it. Also I have special characters for matching, 
> where can I specify raw string combinations.
>
> for example is the search string is not a variable we can say
>
> re.search(r"\$%^search_text", "replace_text", "some_text") but when I read 
> from the dict where shd I place the "r" keyword, unfortunately putting inside 
> key doesnt work "r key" like this
>
> Pseudo code
>
> for string in genobj_of_million_strings:
>pattern = re.compile('|'.join(regex_map.keys()))
>return pattern.sub(lambda x: regex_map[x], string)
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python replace multiple strings (m*n) combination

2017-02-25 Thread Cem Karan
Another possibility is to form a suffix array 
(https://en.wikipedia.org/wiki/Suffix_array#Applications) as an index for the 
string, and then search for patterns within the suffix array.  The basic idea 
is that you index the string you're searching over once, and then look for 
patterns within it.  

The main problem with this method is how you're doing the replacements.  If 
your replacement text can create a new string that matches a different regex 
that occurs later on, then you really should use what INADA Naoki suggested.

Thanks,
Cem Karan

On Feb 25, 2017, at 2:08 PM, INADA Naoki  wrote:

> If you can use third party library, I think you can use Aho-Corasick 
> algorithm.
> 
> https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm
> 
> https://pypi.python.org/pypi/pyahocorasick/
> 
> On Sat, Feb 25, 2017 at 3:54 AM,   wrote:
>> I have a task to search for multiple patterns in incoming string and replace 
>> with matched patterns, I'm storing all pattern as keys in dict and 
>> replacements as values, I'm using regex for compiling all the pattern and 
>> using the sub method on pattern object for replacement. But the problem I 
>> have a tens of millions of rows, that I need to check for pattern which is 
>> about 1000 and this is turns out to be a very expensive operation.
>> 
>> What can be done to optimize it. Also I have special characters for 
>> matching, where can I specify raw string combinations.
>> 
>> for example is the search string is not a variable we can say
>> 
>> re.search(r"\$%^search_text", "replace_text", "some_text") but when I read 
>> from the dict where shd I place the "r" keyword, unfortunately putting 
>> inside key doesnt work "r key" like this
>> 
>> Pseudo code
>> 
>> for string in genobj_of_million_strings:
>>   pattern = re.compile('|'.join(regex_map.keys()))
>>   return pattern.sub(lambda x: regex_map[x], string)
>> --
>> https://mail.python.org/mailman/listinfo/python-list
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


RE: Python application launcher (for Python code)

2017-02-25 Thread Deborah Swanson


> -Original Message-
> From: Python-list 
> [mailto:python-list-bounces+python=deborahswanson.net@python.o
> rg] On Behalf Of Dennis Lee Bieber
> Sent: Saturday, February 25, 2017 12:58 PM
> To: python-list@python.org
> Subject: Re: Python application launcher (for Python code)
> 
> 
> On Sat, 25 Feb 2017 10:03:45 -0800, "Deborah Swanson" 
>  declaimed the following:
> 
> 
> >Didn't think of that one either, but it's easy to export the 
> involved 
> >keys right after installing and restore them before each use.
> >
>   If you can find them -- might be something hidden under 
> one of those cryptic-looking GUID format.

Oh, I'm an old hand at finding Microsoft GUIDs. As a tester at
Microsoft, when a nightly build's uninstall failed (which was often
because the setup team was so crappy), we had to find and delete every
blasted registry key and installed file for the application. I had 50+
servers in my lab, so I identified all the keys and files on one server
and sent the delete operations out over the network to the others. This
method was laborious, but a fraction of the work needed to wipe and
fresh install 50+ servers.

>   Might have to export the entire registry first, 
> install, export entire registry, and run a differences of the two 
> 
> >I like the idea of pulling the wire (cutting internet access) when I 
> >use it. Then nobody (including the app) is getting in or out to look
at 
> >or do anything while the app is running. I won't use it much 
> or often.
> -- 
>   Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/


 

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


Re: Python application launcher (for Python code)

2017-02-25 Thread Wanderer
On Saturday, February 25, 2017 at 1:03:40 PM UTC-5, Deborah Swanson wrote:
> Dennis Lee Bieber wrote, on February 25, 2017 4:50 AM
> > 
> > On Fri, 24 Feb 2017 22:26:15 -0800, "Deborah Swanson" 
> >  declaimed the following:
> > 
> > >
> > >Well rats. Skull duggery on the net is a lot more sophisticated than 
> > >when I saw it last (15 years ago). Getting up to speed with it is on
> my 
> > >list, but quite aways down.  Best strategy is to only plan on using
> it 
> > >a few times and then uninstall. Maybe restore that install from a
> drive 
> > >backup if I need it again, then overwrite with an up to date backup.
> > >
> > Probably won't help... There's likely some cryptic 
> > registry entry encoding the date of last "phone home" (and 
> > maybe number of times started since that date too). If it's 
> > by date, you'd have to fake the date on the computer (I 
> > wouldn't be surprised if the first thing it does is ensure 
> > NTP sync is on, and run a time-server sync). If, in 
> > association, there is a use counter, you'd have to restore an 
> > earlier value of the registry.
> > 
> > And I'm quite certain M$ uninstall won't remove the 
> > registry entries of usage, just so a reinstall (or restore 
> > from backup) can't bypass the system.
> > 
> > -- 
> > Wulfraed Dennis Lee Bieber AF6VN
> > wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
> 
> Didn't think of that one either, but it's easy to export the involved
> keys right after installing and restore them before each use.
> 
> I like the idea of pulling the wire (cutting internet access) when I use
> it. Then nobody (including the app) is getting in or out to look at or
> do anything while the app is running. I won't use it much or often.

If you want to turn internet access on and off more easily in Windows 7, go to 
Control Panel\ Network and Sharing Center and in the left hand menu click on 
Change Adapter Settings. Create a shortcut to Local Area Connect and put it on 
your desktop. Local Area Connect has the internet enable and disable button. I 
also use Networx to keep track of who is phoning home.
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Python application launcher (for Python code)

2017-02-25 Thread Deborah Swanson
Wanderer wrote, on February 25, 2017 2:07 PM
> 
> If you want to turn internet access on and off more easily in 
> Windows 7, go to Control Panel\ Network and Sharing Center 
> and in the left hand menu click on Change Adapter Settings. 
> Create a shortcut to Local Area Connect and put it on your 
> desktop. Local Area Connect has the internet enable and 
> disable button. I also use Networx to keep track of who is 
> phoning home.

Oh, "pulling the wire" and seeing who's trying to call home is quick and
easy enough, in a number of different ways.

I don't have Win7 nor want it, but as this thread evolves, perhaps
someone else reading this will find your information useful.

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


Re: Python application launcher (for Python code)

2017-02-25 Thread breamoreboy
On Friday, February 24, 2017 at 1:54:39 AM UTC, Deborah Swanson wrote:
> Michael Torrie wrote, on February 23, 2017 7:43 AM
> > 
> > On 2017-02-22 09:49 PM, Deborah Swanson wrote:
> > > Didn't even look. Visual Studio has always been pricey, and it never
> 
> > > occurred to me that they might have a free or cheap version now.
> > 
> > You can get the full edition of Visual Studio, called Visual Studio 
> > Community Edition for free.  They still offer Visual Studio Express,
> but 
> > I think they recommend the full community edition to most people now. 
> > The biggest downside to the VS Community Edition is that it has to
> phone 
> > home and log in to MS's developer web site from time to time to stay 
> > active.  Sigh. MS almost gets it, but not quite.
> 
> Another free version of Visual Studio, wonders never cease!
> 
> As for it phoning home, I won't use it for long, and then I might not
> ever use it again. Wonder what value they think this has, other than
> giving them a nosecount of how many active copies there are at any given
> time.

As an alternative to Visual Studio Community Edition, which takes forever and a 
day to download and install, you might like to give Visual Studio Code a try 
https://code.visualstudio.com/

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: any one used moviepy please come in!!! I need help, thanks!

2017-02-25 Thread Santhosh Kumar
Thanks a lot , I got this solution after installing ghostscript

Regards
sandy

On Thu, Feb 23, 2017 at 6:15 PM, Billy Earney 
wrote:

>  imagemagick (ie, convert) has a policy.xml file that stops you from
> accessing any resource that starts with '@'.
>
> type 'identify -list policy'
> the first line should tell you where your policy.xml file is located. My
> policy.xml file is lcoated at /etc/ImageMagick-6/policy.xml
>
> open that file, and goto to the end and comment out (or remove the line
> that reads)
>
> 
>
> since this is xml, you can comment out this line by appending the line
> with 
>
> Hope this helps!
>
> On Thu, Feb 23, 2017 at 1:05 AM,  wrote:
>
>> On Thursday, January 26, 2017 at 8:12:24 AM UTC+5:30, Tony Chen wrote:
>> > On Wednesday, January 25, 2017 at 8:34:01 PM UTC+13, Chris Angelico
>> wrote:
>> > > On Wed, Jan 25, 2017 at 6:22 PM, Tony Chen <
>> tonytonytony0...@gmail.com> wrote:
>> > > > This error can be due to the fact that ImageMagick is not installed
>> on your computer, or (for Windows users) that you didn't specify the path
>> to the ImageMagick binary in file conf.py, or.that the path you specified
>> is incorrect
>> > >
>> > > So... is ImageMagick installed?
>> > >
>> > > ChrisA
>> >
>> > Okay... Yes it's installed. This problem has been solved haha. Thank
>> you for replying.
>>
>> Hi Tony,
>> same issue facing by me. kindly help me
>> please list the solution
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Python application launcher (for Python code)

2017-02-25 Thread Deborah Swanson
breamore...@gmail.com wrote, on February 25, 2017 4:49 AM
> 
> On Friday, February 24, 2017 at 1:54:39 AM UTC, Deborah Swanson wrote:
> > Michael Torrie wrote, on February 23, 2017 7:43 AM
> > > 
> > > On 2017-02-22 09:49 PM, Deborah Swanson wrote:
> > > > Didn't even look. Visual Studio has always been pricey, and it 
> > > > never
> > 
> > > > occurred to me that they might have a free or cheap version now.
> > > 
> > > You can get the full edition of Visual Studio, called 
> Visual Studio
> > > Community Edition for free.  They still offer Visual 
> Studio Express,
> > but
> > > I think they recommend the full community edition to most people 
> > > now.
> > > The biggest downside to the VS Community Edition is that it has to
> > phone
> > > home and log in to MS's developer web site from time to 
> time to stay
> > > active.  Sigh. MS almost gets it, but not quite.
> > 
> > Another free version of Visual Studio, wonders never cease!
> > 
> > As for it phoning home, I won't use it for long, and then I 
> might not 
> > ever use it again. Wonder what value they think this has, 
> other than 
> > giving them a nosecount of how many active copies there are at any 
> > given time.
> 
> As an alternative to Visual Studio Community Edition, which 
> takes forever and a day to download and install, you might 
> like to give Visual Studio Code a try https://code.visualstudio.com/
> 
> Kindest regards.
> 
> Mark Lawrence.

Thanks Mark, I will take a look at it.  It sounds like a real pain to
keep on top of all the invasions from Microsoft and who knows else, but
likely that's all set up in Visual Studio Community's .NET installation
code. I don't/won't have any .NET after about version 3 on my computers,
so it just occurs that I may not even be able/willing to install it.
Later versions of dotNet not only phone home, but can also serve as a
backdoor to the NSA and other government nasties. That's one reason why
they're all so keen on killing XP, because anything before SP3 can't be
instrumented in that way, and a major reason why I'm sticking with XP
SP2 until I can get back on Linux. And on top of that, now you say
Visual Studio Community Edition takes a long time to download and
install, even if you're willing to live with all that comes with it (I'm
not).

I almost have a verifiably working version in Python of the funcionality
I want from that C library, so I may just bag Visual Studio. It would be
nice to see what calculations they're exactly doing in that C library
because the authors are authorities in this area, but the body of
calculations is all written up in other sources. Once I have a Python
version I can verify against another dataset I have and it checks with
the written sources, I may not care whether I have that C library to
compare to or not.

But if I really want to see all the execution steps in the C code, going
with Visual Studio Code is probably the way to go.  Heck, I thought it
would be a shortcut to download the open source C code and model my code
after it, but it's turned into a rats nest of trouble, which likely
won't tell me anything I don't already know at this point.

Deborah

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


Problem With Tkinter Font

2017-02-25 Thread Wildman via Python-list
Python 3.4.2
Tkinter 8.6
Linux

I want to set the font in a GUI program I am working on.
Here is the pertinent code I am using...

from tkinter import font

myfont = font.Font(family='Helvetica', size=10, weight='bold')

Here is the error I get...

Traceback (most recent call last):
  File "./test.py", line 41, in 
myfont = font.Font(family='Helvetica', size=10, weight="bold")
  File "/usr/lib/python3.4/tkinter/font.py", line 93, in __init__
tk.call("font", "create", self.name, *font)
AttributeError: 'NoneType' object has no attribute 'call'

>From my research, the syntax is correct but I am having
doubts.  Can anyone clarify?

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list