TypeError: Can't convert 'int' object to str implicitly
Dave Angel
davea at davea.name
Fri Apr 26 15:25:56 EDT 2013
On 04/26/2013 02:02 PM, Chris Angelico wrote:
>
>
>>> <SNIP>
>
> Here's a massive simplification of the OP's program:
>
> 1. Build a list of device IDs
> 2. Edit the file "firstdev.ahk" and replace all instances of "device"
> with the device ID
> 3. Execute the now-edited firstdev.ahk using os.system()
> 4. Reverse the edit of firstdev.ahk, replacing all instances of the
> device ID with the word "device".
>
> Apart from the risk of accidentally changing back something that
> wasn't changed in the first place (which the OP may know to be
> impossible, eg if the macro file has no numbers in it), this has the
> risk that a computer failure in step 3 will leave the file on disk in
> its edited state. That's what I'm concerned about. By writing the
> modified .ahk content to a different file and then executing the other
> file, he would avoid editing the template at all. It'd also then be
> multi-process safe, for what that's worth.
>
OK, thanks. That makes perfect sense. Somehow I missed that it was the
altered file that was being used as a script. I just assumed it was
like a config file for some program, where the name is hardwired.
--
DaveA
More information about the Python-list
mailing list