Windows 7

Name a new file with stdin

Hi all,

Im a newbie to Tcl and need some help/advice. I’m writing a program that will connect to several Cisco routers run some commands and send the output to a text file.

I want to name the text file with the hostname from the router prompt. In my current script below, the text file is created but there is no name.

I think the problem may be in these 2 lines

gets stdin line
set fh [open $line.txt a+]

My script below

package require Expect

package require Expect

set username cisco
set password cisco
set expect_out(buffer) {}

set IP [open "ip.txt" r]

Problem installing UDP Package

I just upgraded my machine from WinXP to Win7. I then installed ActvieTCL 8.5.9 and attempted to use teacup to install the udp package. However, I get the following error:

Retrieving package udp 1.0.9 win32-x86_64 ...@ http://teapot-be.activestate.com
... Error:

        This operation needs a business edition license installed to
        succeed. Please visit
        http://www.activestate.com/business-edition to learn more about
        the ActiveTcl Business Edition offering.

        Unable to install the full list. Aborting.

time functions execute out of order

I ran this code both interactively and as a .py file:

import time
def a():
    print "starting"
    time.sleep(5)
    print "finishing"

a()

My intention was to have "starting" print at the beginning, then a five second pause, then to have "finishing" printed.

Instead when I run the program, nothing happens for (a bit more than) 5 seconds, then "starting" and "finishing" print right after each other with no pause between them.

The same thing happened when I replaced the time.sleep(5) function with a handmade 5-second-pause function.

mysql + not EN characters

Hi, I'm using activeperl in win7 and have the following problem with MySql connection.

For a reason I can't select data when "where" clause contains some not EN characters. Returned data set is always empty. I tried to set mysql_enable_utf8=1 and unicode collation but with no success. The same script works properly with Strawberry perl. Could you please help?

Many thx in advance.

Trouble with PPM and @INC

I am installing the W3C Validator (validator.w3.org) which I have done many times before.
It requires SGML::Parser::OpenSP which is only available in precompiled form for 5.8, and compiling it is very hard (because of some dependencies).

Introduction out of the way, I installed ActivePerl in C:\Webserv\ActivePerl\5.8.9\.
PPM and the CPAN command line are adding modules to .\site\lib instead of .\lib.
I changed the #! in the script to #!C:/Webserv/ActivePerl/5.8.9/bin/perl.exe -T
and Apache seems to be executing it properly, but I get this error:

idle closes immediately

I installed ActivePython 2.7 (32-bit) on a Windows 7 box (x64). When I run idle from the Start menu, idle closes its window immediately. If I run idle from a cmd box, it seems to run fine:

> cd \ActivePython27
> Lib\idlelib\idle.bat

Any thoughts?

can't uninstall ActivePython...

I did an uninstall of ActiveState python both 64 & 32 bit versions, and even a reboot, and installed the FOSS (python.org)python (2.7).

But oddly enough, when I run python (cmd line) I still get ActiveState python reported:
E:\Plang\python>python
ActivePython 2.7.0.2 (ActiveState Software Inc.) based on
Python 2.7 (r27:82500, Aug 23 2010, 17:18:21) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> copyright()
Copyright (c) 2000-2010 ActiveState Software Inc.

Xml with perl

Hello,

I have a large number of xml files in a folder. I want to read and extract the content of each xml file to a new.txt. I'm only interested in the content having the tag , and i want to create a .txt file (a texte file for each of my xml's). I use the perl modules xml twig and xml simple. There's the code i have until now:

my $xml_dir="C:\xmlperl";
my $output="C:\xmlperl\output.txt";
my $file = $ARGV[0];

opendir(DIR,$xml_dir) || die;

my @TranscriptsList = grep(/xml$/, readdir(DIR));
closedir(DIR);

foreach $file (@TranscriptsList) {

PerlCritic Aborting - Magic Number checking failed

When I attempt to run my perlcritic-gui.exe, I am getting an abend with the error message:

Failed to obtain list of policies from percritic-dump Magic number checking on storable fiel failed at ..\..\lib\Storable.pm (autosplit into ..\..\lib\auto\Storable\fd_retrieve.al) line 398, at /<C:\Program Files\ActiveState Perl Dev Kit 8.0.1\bin\perlcritic-gui.exe>PDK/PerlCritic/Policy.pm line 21

Does anyone have any idea what might need to be done to get PerlCritic to work?

Unable to Import my user created module

I built a module called "categories.py" and put it in the folder c:\pytemp .

I made sure that "c:\pytemp" was on the python path, and checked to see that it was in sys.path. It was the very first item after ''.

When I ran "import categories," I got the error "No module named categories"

I am new to the Python world, but it sure seems I followed the docs. What might work here?

Thanks.