Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6896783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:05:14+00:00 2026-05-27T07:05:14+00:00

I have a Mathematica file called myUsefulFunctions.m containing, for example, a function called mySuperUsefulFunction.

  • 0

I have a Mathematica file called myUsefulFunctions.m containing, for example, a function called mySuperUsefulFunction. Suppose I call mySuperUsefulFunction in a notebook and get the following error:

Part::pspec: Part specification #1 is neither an integer nor a list of integers. >>

Is there a way to find the line in myUsefulFunctions.m where this error occurred?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:05:15+00:00Added an answer on May 27, 2026 at 7:05 am

    I don’t know of a way to find the line in the file, which I assume was read without error.

    You can however use Trace and related functions to see where in the evaluation chain the error occurs.

    Example:

    myFunc1[x_, y_] := x[[y]]
    myFunc2[a_List, n_] := Pick[a, a, myFunc1[a, n]]
    
    myFunc2[Range@10, #1]
    
    During evaluation of In[4]:= Part::pspec: Part specification #1 is neither an integer nor a list of integers. >>
    

    With Trace:

    myFunc2[Range@10, #1] // Trace // Column
    
    {Range[10], {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}
    myFunc2[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, #1]
    Pick[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, myFunc1[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, #1]]
    {myFunc1[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, #1], {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}[[#1]], {Message[Part::pspec, #1], {MakeBoxes[Part::pspec: Part specification #1 is neither an integer nor a list of integers. >>, StandardForm], RowBox[{RowBox[{Part, ::, "pspec"}], : , "\!\(\*StyleBox[\"\\\"Part specification \\\"\",  \"MT\"]\)\!\(\*StyleBox[\!\(#1\),  \"MT\"]\)\!\(\*StyleBox[\"\\\" is neither an integer nor a list of integers.\\\"\",  \"MT\"]\) \!\(\*ButtonBox[\">>\",  ButtonStyle->\"Link\",  ButtonFrame->None,  ButtonData:>\"paclet:ref/message/General/pspec\",  ButtonNote -> \"Part::pspec\"]\)"}]}, Null}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}[[#1]]}
    

    You can see that just before Message[Part::pspec, #1] is called, which results in a long mess of formatting, we had:

    {myFunc1[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, #1], {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}[[#1]]

    This shows that myFunc1[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, #1] is called, and this causes evaluation of {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}[[#1]] which is clearly in error.

    Please see this question and its answers for a more convenient use of Trace:

    https://stackoverflow.com/q/5459735/618728

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this many hundreds of cell long Mathematica file and I want to
i have the following xml file <entry> <math marks>45</math marks> <eng marks>67</eng marks> <phy
Let's say I have a text file of basic mathematical functions. I want to
If you have Mathematica code in foo.m, Mathematica can be invoked with -noprompt and
In Mathematica I have a list: x = {1,2,3,3,4,5,5,6} How will I make a
I have a 15-day trial of Mathematica and need to evaluate it, and see
I have a javascript function that accepts a number and performs a mathematical operation
Have you ever seen any of there error messages? -- SQL Server 2000 Could
I have a problem. I have an XML file that contains information about 100
I have a program that loads a file (anywhere from 10MB to 5GB) a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.