+ Reply to Thread
Results 1 to 4 of 4

Running Python script fails

  1. #1
    Registered User
    Join Date
    07-29-2018
    Location
    In the Queen's Shed
    MS-Off Ver
    2013
    Posts
    23

    Question Running Python script fails

    Hi,

    I am trying to run a Python script from VBA as follows:

    Please Login or Register  to view this content.
    The Python script produces a text file with an array of 100 times 100 random numbers between 0 and 1 as follows:

    Please Login or Register  to view this content.
    If I run the VBA macro, a window briefly flashes up, and then closes again. There is no text file output. If I call the Python code on its own, the output random_array_output.txt is generated.

    How to resolve please?

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,369

    Re: Running Python script fails

    Administrative Note:

    Although we value your privacy as much you do, it could be important that members have a rough idea of your location as the solutions they offer may be affected by your locale. For instance, you might in the future post questions which are related to your regional settings.

    With this in mind, please update your profile to something more precise (something such as UK, Europe, USA, UAE, etc. will suffice).

    Thank you for helping us to help you.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Running Python script fails


    Quote Originally Posted by Pak Mariman View Post
    The Python script produces a text file with an array of 100 times 100 random numbers between 0 and 1
    Hi,

    as this is a VBA forum why not doing it directly under VBA ?!

  4. #4
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    237

    Re: Running Python script fails

    Python scripts need to run in a terminal. Locally executing the file won't work. You'll need to use Shell with something like;

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA script not running with blocked cells (not the ones the vba script is using)
    By Edward Hyde in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-25-2023, 05:22 PM
  2. VBA running python code
    By Ged Salter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-15-2021, 10:22 AM
  3. Running a Python Script from Excel VBA
    By DeanMcK in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2021, 05:26 PM
  4. call a python script from excel vba
    By sheffieldlad in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2013, 07:11 PM
  5. Script fails to run in other office/vba version 2007 > 2003
    By vin1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-22-2012, 05:35 AM
  6. VBA + VB Script fails to open the workbook.
    By Suresh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-03-2006, 05:45 AM
  7. Script fails in Excel was okay before.
    By Jonah in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-05-2006, 05:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1